Answers for "pandas select unique values in a column"

4

dataframe unique values in each column

for col in df:
    print(df[col].unique())
Posted by: Guest on August-20-2020
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 "pandas select unique values in a column"

Python Answers by Framework

Browse Popular Code Answers by Language