Pandas value_counts() method

I have a question regarding section 10 of the “Introduction to pandas” unit. It says the value_counts() method is a series only method and won’t work on a dataframe.

In the pandas documentation, it looks like this method should also work for dataframes. Could someone clarify what I am missing?

3 Likes

Hello @nicole20, DataFrame.value_counts was introduced in version 1.1.0. At the time DataQuest created the course, there was no DataFrame.value_counts, that’s why.

4 Likes

I think, It’s the improvement in panda’s documentation, now it works for both (series and DataFrame).

3 Likes

It will work Equivalent method on both Dataframe & Series. And the documentation says the same.

Hope it is clear now.

Best
K!

2 Likes

Thank you, everyone!

2 Likes