Pandas Data Cleaning and Preprocessing: Exercises, Solutions with Explanation
[An editor is available at the bottom of the page to write and execute the scripts. Go to the editor]
Pandas Data Cleaning and Preprocessing [15 exercises with solution]
More exercises focused on cleaning and preprocessing data, including dealing with outliers, duplicates, and data normalization.
1. Write a Pandas program to fill missing values (NaN) in a DataFrame using fillna().
Click me to see the sample solution
2. Write a Pandas program to drop rows with missing data.
Click me to see the sample solution
3. Write a Pandas program to detect duplicates using duplicated() method.
Click me to see the sample solution
4. Write a Pandas program to remove duplicates rows from a DataFrame.
Click me to see the sample solution
5. Write a Pandas program to handle outliers in a DataFrame with Z-Score method.
Click me to see the sample solution
6. Write a Pandas program that normalizes data with Min-Max scaling.
Click me to see the sample solution
7. Write a Pandas program to bin data into categories.
Click me to see the sample solution
8. Write a Pandas program that handles text data with str.replace().
Click me to see the sample solution
9. Write a Pandas program to convert data types using astype().
Click me to see the sample solution
10. Write a Pandas program to remove leading and trailing whitespace using str.strip().
Click me to see the sample solution
11. Write a Pandas program to change column names to lowercase.
Click me to see the sample solution
12. Write a Pandas program to replacing missing data with mean value.
Click me to see the sample solution
13. Write a Pandas program to remove columns with too many missing values.
Click me to see the sample solution
14. Write a Pandas program to reorder columns in a DataFrame.
Click me to see the sample solution
15. Write a Pandas program to split a column into multiple columns.
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://www.w3resource.com/python-exercises/pandas/pandas-data-cleaning-and-preprocessing.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics