pandas之value_counts

A set of lottery data

(A) count the number of 0 to 9, each number appearing on the first column a1

pd.value_counts(df.a1)

(B) count the number of all data in the respective data 0 to 9 appear

pd.value_counts(df.values.flatten()) 

 

Guess you like

Origin www.cnblogs.com/jm7612/p/12488849.html
Recommended