Inconsistent Results Between Pandas and Polars using cut (and qcut)? #18236
Labels
bug
Something isn't working
needs triage
Awaiting prioritization by a maintainer
python
Related to Python Polars
Checks
Reproducible example
I asked this question on StackOverflow here but am unsure if it’s related to a bug.
I’m switching from Pandas to Polars to create quantile-based portfolios, aiming to categorize a numerical variable into equal-sized portfolios using quantile breakpoints. Therefore, I am using the cut function.
However, I’m seeing discrepancies in the bins generated by Pandas and Polars, resulting in inconsistent outcomes between the two implementations.
Function for quantile-based binning using Pandas
Function for quantile-based binning using Polars
Example
Log output
No response
Issue description
Discrepancies in the bins generated by Pandas and Polars, resulting in inconsistent outcomes between the two implementations.
Expected behavior
Same bins for both packages.
Installed versions
The text was updated successfully, but these errors were encountered: