I want to get all value count in dataframe, so wrote this
counter = df.value_counts();
print(counter);
I expected this style
100.0 4
25.0 7
0.0 2
.
.
but it show me this, not value count.
Series([], dtype:int64)
What should I do to get value that I expected?
CodePudding user response:
IIUC, you can flatten the dataframe values and convert it to Series
out = pd.Series(df.values.flatten()).value_counts()