How to use apply().fillna() function to calculate the frequency of unique value In Python Pandas
Here we are filling NAN or 0 for the None values in the series and apply function to apply the same, and then calculate their frequencies.
Python3
import pandas as pd technologies = { "data" :[ 2 , 3 , 4 , 5 , 5 , 6 , 7 , 8 , 9 , 5 , 3 ] } df = pd.DataFrame(technologies) df1 = df. apply (pd.value_counts).fillna( 0 ) print (df1) |
Output:
Calculate the frequency counts of each unique value of a Pandas series
Let us see how to find the frequency counts of each unique value of a Pandas series. We will use these methods to calculate the frequency counts of each unique value of a Pandas series.