Pandas Practice Set-1: Count the duplicate rows of diamonds DataFrame
Pandas Practice Set-1: Exercise-65 with Solution
Write a Pandas program to count the duplicate rows of diamonds DataFrame.
import pandas as pd diamonds = pd.read_csv('https://raw.githubusercontent.com/mwaskom/seaborn-data/master/diamonds.csv') print("Original Dataframe:") print(diamonds.shape) print("\nDuplicate rows of diamonds DataFrame:") print(diamonds.duplicated().sum())
Original Dataframe: (53940, 10) Duplicate rows of diamonds DataFrame: 146
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a Pandas program to read the diamonds DataFrame and detect duplicate color.
Next: Write a Pandas program to calculate the memory usage for each Series (in bytes) of diamonds DataFrame.
What is the difficulty level of this exercise?
- New Content published on w3resource :
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework