Answers for "select only unique values in a column pandas"

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 "select only unique values in a column pandas"

Python Answers by Framework

Browse Popular Code Answers by Language