Pandas cut vs. qcut Explained Clearly (Finally)
Last Updated on December 11, 2023 by Editorial Team
Author(s): Bex T.
Originally published on Towards AI.
How to customarily bin data in Pandas
Photo by Karan Bhatia on Unsplash
βWhat the heck is this?β
That is the reaction beginners often get when they look at the output of some hard pandas function. It always baffles me how lots of tutorials and courses introduce such functions in a single sentence and move on to other topics in a heartbeat. Even if you read their documentation from top to bottom, it is gonna be more than a minute, guaranteed.
As a beginner, I was always so frustrated when I was in such situations. One time, while doing a nano degree at Udacity, I was learning about Matplotlibβs heatmaps. As you know, Matplotlib cannot create annotations for heatmaps automatically like Seaborn, so you had to create them by hand. To do that, you would useqcut or cut (which are the topic of this article) to bin your data into categories, and I was completely new to these functions.
The instructor, in a single sentence, briefly βexplainedβ the functions and a link to the documentation appeared on the screenU+1F926βU+2642οΈ. He even fast-forwarded through the parts where he was typing out the syntax.
Lately, I have been writing a little series explaining the hardest functions pandas in the hopes that other people wonβt… Read the full blog for free on Medium.
Join thousands of data leaders on the AI newsletter. Join over 80,000 subscribers and keep up to date with the latest developments in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming aΒ sponsor.
Published via Towards AI