From the course: pandas Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Using value_counts()

Using value_counts() - pandas Tutorial

From the course: pandas Essential Training

Start my 1-month free trial

Using value_counts()

- [Instructor] Basic Analysis. Value_counts, value_counts is one of the most useful methods in pandas. It returns a series object, counting all the unique values. There are two things in particular to be aware of value_counts. As this is returning a count of the unique values, the first value is the most frequently occurring element. The second, the second most frequently occurring element and so on. This order can be reversed by just setting the ascending flag to True. Dropna, one of the parameters within the value_counts is True by default and you will not get a count of the na values. The na values remember are the missing data values. If your data set has a significant number of na values, this can be misleading and you can turn this feature off by setting dropna to False. Let's now head over now to our Jupyter notebook, to look at value_counts. As we've done previously, let's import pandas as pd and read the CSV file into our data frame. Everything seems to be in order so let's…

Contents