While working a pandas value_counts
exercise, the return is never what is expected and what I need to get
The code I used is:
import pandas as pddf = pd.DataFrame({'a':[1, 1, 2, 2, 2]})value_counts = df['a'].value_counts(dropna=True, sort=True)print(value_counts)
The problem is that the code should be printing:
2 31 2Name: a, dtype: int64
But instead its printing:
a2 31 2Name: count, dtype: int64
Is there any explanation why? I'm using Jupyter if it helps. Thanks