October 2019
Beginner to intermediate
674 pages
16h 43m
English
The value_counts() function works only on series, and not DataFrames. It counts the number of times each variable occurs and provides a frequency table-like output:
pd.Series(["Pandas", "Pandas", "Numpy", "Pandas", "Numpy"]).value_counts()
The following is the output:

The value_counts() function can also be applied to a numeric column. It results in a count of each time a value occurs:
sample_df["Nominations"].value_counts()
The following is the output:

Read now
Unlock full access