Pandas version checks
-
[X] I have checked that this issue has not already been reported.
-
[X] I have confirmed this bug exists on the latest version of pandas.
-
[ ] I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
import numpy as np
import pandas as pd
pd.qcut([1,2,3,4,5,-np.inf, np.inf], q=3)
Results in:
ValueError: Bin edges must be unique: array([nan, 2., 4., nan]). You can drop duplicate edges by setting the 'duplicates' kwarg
```python
import numpy as np
import pandas as pd
pd.qcut([1,2,3,4,5,-np.inf, np.inf], q=3, duplicates="drop")
Results in:
ValueError: missing values must be missing in the same location both left and right sides
```
Issue Description
After upgrading from pandas 1.1.5 to the latest version 1.5.3 I am now receiving an error when the list contains np.inf
that is given to pd.qcut
. In the older version this was working.
Using duplicates="drop"
also doesn't help.
Expected Behavior
I was expecting the first and last bin to contain np.inf. This was working in pandas 1.1.5.
Installed Versions
Comment From: HansBambel
Since this was working in 1.1.3 and not working in 1.5.3 it is likely something different than, but they might be related: https://github.com/pandas-dev/pandas/issues/11113 https://github.com/pandas-dev/pandas/issues/24314