How to get frequency counts of a column in Pandas DataFrame

Previous
Next

In this post, we will see how to get frequency counts of a column in Pandas DataFrame.

Sometimes, you might have to find counts of each unique value for the categorical column. You can use value_count() to get frequency counts easily. value_count() returns series object with frequency counts data for a column.

Here is sample Employee data that will be used in below example:

Name Age Department
Adam 27 HR
Reena 22 Sales
Mahesh 33 Tech
Supriya 26 HR
Aman 34 Tech

Output:

As you can see, we got Frequency counts for each unique value in column Department.
That’s all about how to get frequency counts of a column in Pandas DataFrame.

Previous
Next

Add Comment