0

i have a dataframe column which contains these values: A A A F R R B B A ... I would like to make a list summarizing the different strings, as [A,B,F,...]. I've used groupby with nunique(), but I don't need counting. How can I make the list ? Thanks

Rome
  • 1
  • 1

1 Answers1

0

unique() is enough

df['col'].unique().tolist()

pandas.Series.nunique() is to return the number of unique items.

Ynjxsjmh
  • 28,441
  • 6
  • 34
  • 52