Answers for "how to get value_counts output in dataframe format"

1

how to get value_counts output in dataframe format

df = df.value_counts().rename_axis('unique_values').reset_index(name='counts')
print (df)
   unique_values  counts
0              2       3
1              1       2
Posted by: Guest on April-07-2021
2

plot value counts pandas

df.letters.value_counts().sort_values().plot(kind = 'barh')
Posted by: Guest on November-29-2020

Code answers related to "how to get value_counts output in dataframe format"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language