A Hidden Feature of Describe Method In Pandas
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.
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.