Source Code:
(back to article)
import pandas as pd # create a sample dataframe df = pd.DataFrame({'A': [1, 2, 3, 1, 2, 3, 1, 2, 3], 'B': ['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c']}) # count the frequency of values in column 'A' value_counts = df['A'].value_counts() print(value_counts)
Result:
Report an issue