Pandas Machine Learning Integration: Exercises and Solutions for Data Integrity
[An editor is available at the bottom of the page to write and execute the scripts. Go to the editor]
Pandas Machine Learning Integration [17 exercises with solution]
Structure of data.csv:
ID Name Age Gender Salary Target 1,Sara,25,Female,50000,0 2,Ophrah,30,Male,60000,1 3,Torben,22,Male,70000,0 4,Masaharu,35,Male,80000,1 5,Kaya,NaN,Female,55000,0 6,Abaddon,29,Male,NaN,1
Column Description:
ID: A unique identifier for each record (integer).
Name: The name of the individual (string).
Age: Age of the individual (numerical, may have missing values).
Gender: Gender of the individual (categorical: Male/Female).
Salary: The individual's salary (numerical, may have missing values).
Target: The target variable for binary classification (binary: 0 or 1).
1. Write a Pandas program that loads a Dataset from a CSV file.
Click me to see the sample solution
2. Write a Pandas program to check for missing values in a dataset.
Click me to see the sample solution
3. Write a Pandas program to drop rows with missing values from a dataset.
Click me to see the sample solution
4. Write a Pandas program that fills missing values with the Mean.
Click me to see the sample solution
5. Write a Pandas program that converts categorical variables into numerical values using label.
Click me to see the sample solution
6. Write a Pandas program to apply one-hot encoding to categorical variables.
Click me to see the sample solution
7. Write a Pandas program that normalizes numerical data using Min-Max scaling.
Click me to see the sample solution
8. Write a Pandas program to standardize numerical data using Z-Score scaling.
Click me to see the sample solution
9. Write a Pandas program that splits Dataset into Training and Testing sets.
Click me to see the sample solution
10. Write a Pandas program that removes outliers from a Dataset.
Click me to see the sample solution
11. Write a Pandas program that imputes missing values using K-Nearest neighbours.
Click me to see the sample solution
12. Write a Pandas program to select feature selection using variance threshold.
Click me to see the sample solution
13. Write a Pandas program to handling class imbalance using random oversampling.
Click me to see the sample solution
14. Write a Pandas program that applies Polynomial Features for feature expansion.
Click me to see the sample solution
15. Write a Pandas program to scale numerical features using Scikit-learn's RobustScaler.
Click me to see the sample solution
16. Write a Pandas program to save the processed Dataset to a CSV file.
Click me to see the sample solution
17. Write a Pandas program that applies Log Transformation to Skewed Data.
Click me to see the sample solution
Python-Pandas Code Editor:
More to Come !
Do not submit any solution of the above exercises at here, if you want to contribute go to the appropriate exercise page.
Test your Python skills with w3resource's quiz
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://198.211.115.131/python-exercises/pandas/pandas-machine-learning-integration.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics