2
$\begingroup$

I have some continuous variable in my data that I wish to apply binning for. The values range from 0 to 800 but I got motivated by the fact that the data distribution was left skewed as you could see in the following figure: enter image description here

However, I have read this amazing blog about binning data this whereby the author claims that adaptive binning is better than fixed-width binning. I understand the idea behind this because the some of the bins that we define in the fixed-width approach may have too little data distribution in comparison to other bins, which won't be a fair game to play whereby the adaptive approach, motivated by the idea of quantiles is better. Are there any more arguments, or more in depth analysis, of this hypothesis ?

$\endgroup$
1
$\begingroup$

I took a look at that link. It's pretty informative. As you already know, The cut function is used to specifically define the bin edges. There is no guarantee about the distribution of items in each bin. In fact, you can define bins in such a way that no items are included in a bin or nearly all items are in a single bin. The qcut function is slightly different. The qcut function tries to divide up the underlying data into equal sized bins. The function defines the bins using percentiles based on the distribution of the data, not the actual numeric edges of the bins. In conclusion, if you want equal distribution of the items in your bins, use qcut . If you want to define your own numeric bin ranges, then use cut.

See the link below for more details.

https://pbpython.com/pandas-qcut-cut.html

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.