You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The difference is that now the groupby() value_counts() operation returns a Series named equivalently to the column on which value_counts() was computed.
df.groupby('a').b.value_counts()
0.18.0
ab01221111dtype: int64
0.18.1 (including 0.18.1+367.g6b7857b)
ab01221111Name: b, dtype: int64
This change in behavior is not completely unexpected given that outside of groupby(), value_counts() has historically returned a Series named equivalently to the column the operation was performed on:
df.a.value_counts()
0311Name: a, dtype: int64
A manual workaround would be to rename the Series before reset_index() as follows:
Code Sample
Expected Output
In version 0.18.0, the output was:
The difference is that now the groupby() value_counts() operation returns a Series named equivalently to the column on which value_counts() was computed.
0.18.0
0.18.1 (including 0.18.1+367.g6b7857b)
This change in behavior is not completely unexpected given that outside of groupby(), value_counts() has historically returned a Series named equivalently to the column the operation was performed on:
A manual workaround would be to rename the Series before reset_index() as follows:
However, the one-line functionality was much appreciated. Being able to pass a new name to value_counts() could solve this issue?
output of
pd.show_versions()
The text was updated successfully, but these errors were encountered: