How to create a frequency table for a pandas Series in Python

A frequency table shows the number of occurences for each possible value in a pandas.Series, a one-dimensional array that can hold the information of a single variable. For the series [1, 1, 2, 2, 3] the frequency table would be {1: 2, 2: 2, 3: 1}.

Solution for How to create a frequency table for a pandas Series in Python : You can use Series.value_counts() to create a frequency table Call Series.value_counts() to get the frequency table. Use the dictionary syntax frequency_table[key] where key is a value from the original Series.


how-to-create-a-frequency-table-for-a-pandas-series-in-python