Answers for "python - subset dataframe based on unique value of a clumn"

0

python - subset dataframe based on unique value of a clumn

# Keep first duplicate value
my_df = my_df.drop_duplicates(subset=['my_var'])

# Keep last duplicate value
my_df = my_df.drop_duplicates(subset=['my_var'], keep='last')

# Remove all duplicate values
my_df = my_df.drop_duplicates(subset=['my_var'], keep=False)
Posted by: Guest on October-20-2020

Code answers related to "python - subset dataframe based on unique value of a clumn"

Python Answers by Framework

Browse Popular Code Answers by Language