Show list of possible values of feature in Pandas

Viewed 1235

I have a pandas dataframe and I want to iterate over the possible values of a given column. I want something like this:

data = pd.read_csv("data.csv")
column = data['feature']

for value in column.show_list_of_all_possible_values:
    print(value)

output:

value_0
value_1
value_2
1 Answers

Try:

data['feature'].value_counts()

Or

data['feature'].unique()
Related