Daily Dose of Data Science

Share this post

A Hidden Feature of Describe Method In Pandas

www.blog.dailydoseofds.com

A Hidden Feature of Describe Method In Pandas

Avi Chawla
Nov 18, 2022
3
Share

The ๐—ฑ๐—ฒ๐˜€๐—ฐ๐—ฟ๐—ถ๐—ฏ๐—ฒ() method in Pandas is commonly used to print descriptive statistics about the data.

But have you ever noticed that its output is always limited to numerical columns? Of course, details like mean, median, std. dev., etc. hold no meaning for non-numeric columns, so the results make total sense.

However, ๐—ฑ๐—ฒ๐˜€๐—ฐ๐—ฟ๐—ถ๐—ฏ๐—ฒ() can also provide a quick summary of non-numeric columns. You can do this by specifying ๐—ถ๐—ป๐—ฐ๐—น๐˜‚๐—ฑ๐—ฒ="๐—ฎ๐—น๐—น." As a result, it will return the number of unique elements, the top element with its frequency.

Read more: Documentation.

Share this post on LinkedIn: Post Link.

Thanks for reading Daily Dose of Data Science! Subscribe for free to learn something new and insightful about Python and Data Science every day. Also, get a Free Data Science PDF (250+ pages) with 200+ tips.


I like to explore, experiment and write about data science concepts and tools. You can read my articles on Medium. Also, you can connect with me on LinkedIn.

3
Share
Previous
Next
Comments
Top
New
Community

No posts

Ready for more?

ยฉ 2023 Avi Chawla
Privacy โˆ™ Terms โˆ™ Collection notice
Start WritingGet the app
Substackย is the home for great writing