We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
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 <details> INSTALLED VERSIONS ------------------ commit : 2e218d10984e9919f0296931d92ea851c6a6faf5 python : 3.9.16.final.0 python-bits : 64 OS : Darwin OS-release : 22.2.0 Version : Darwin Kernel Version 22.2.0: Fri Nov 11 02:04:44 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T8103 machine : x86_64 processor : i386 byteorder : little LC_ALL : None LANG : None LOCALE : None.UTF-8 pandas : 1.5.3 numpy : 1.23.5 pytz : 2022.7.1 dateutil : 2.8.2 setuptools : 67.0.0 pip : 22.3.1 Cython : None pytest : 7.2.1 hypothesis : None sphinx : 6.1.3 blosc : None feather : None xlsxwriter : None lxml.etree : None html5lib : None pymysql : None psycopg2 : 2.9.5 jinja2 : 3.1.2 IPython : None pandas_datareader: None bs4 : None bottleneck : None brotli : None fastparquet : 2023.1.0 fsspec : 0.8.7 gcsfs : None matplotlib : None numba : 0.56.4 numexpr : None odfpy : None openpyxl : 3.0.10 pandas_gbq : None pyarrow : None pyreadstat : None pyxlsb : None s3fs : None scipy : 1.9.3 snappy : None sqlalchemy : 1.4.46 tables : None tabulate : 0.8.10 xarray : None xlrd : 1.2.0 xlwt : None zstandard : None tzdata : None </details>
The text was updated successfully, but these errors were encountered:
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: #11113 #24314
Sorry, something went wrong.
No branches or pull requests
Pandas version checks
I have checked that this issue has not already been reported.
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
ValueError: Bin edges must be unique: array([nan, 2., 4., nan]).
You can drop duplicate edges by setting the 'duplicates' kwarg
Results in:
The text was updated successfully, but these errors were encountered: