Get dataframe headers and all the unique values in each column i

There are many ways to show the unique values in all the columns. Please see the below, you can use:

for col in survey_data.columns:
    print(survey_data[col].unique().tolist())

OR

for col in survey_data.columns:
    print(col, survey_data[col].unique().tolist())

OR

for col in survey_data.columns:
    for unique_val in survey_data[col].unique():
        print(col, unique_val)

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top