Answers for "for loop unique values in dataframe coloumns python"

4

dataframe unique values in each column

for col in df:
    print(df[col].unique())
Posted by: Guest on August-20-2020
0

loop through dataframe column and return unique value

which_columns = ... # specify the columns whose unique values you want here

uniques = {col: df[col].unique() for col in which_columns}
Posted by: Guest on August-22-2020

Code answers related to "for loop unique values in dataframe coloumns python"

Python Answers by Framework

Browse Popular Code Answers by Language