-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: "replace" does not work with different numpy-int types even when values are the same #45311
New issue
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
Comments
Could you try on a newer version of pandas? I get this on the main branch
|
I still get the same on version 1.3.5
|
Thanks for checking. Looks like a lot of bug fixes were applied to |
I can add few unit tests for this check. |
fixed in commit: [fb9f205] BUG: Series.setitem failing to cast numeric values (#45121) not directly related to replace, so adding a test is probably a good idea. |
Hey, is this issue still open? I can work on it, with some guidance since it's my first time here. |
Hi! I'm a first time contributor as well, and would love to contribute if it's still open. |
Not sure if this is new - the issue is also extant when comparing np.int16 and np.int32:
Should the unit test be added to https://github.com/pandas-dev/pandas/blob/main/pandas/tests/series/methods/test_replace.py? I can add a unit test comparing np.int16 / np.int64 / np.int32 |
take |
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 master branch of pandas.
Reproducible Example
Issue Description
Using a mapping dictionary where the keys have
np.int64
as type but a series of data where the values arenp.int32
then the replacement is not working.Expected Behavior
Expected to that all integer types can be evaluated against each-other
Installed Versions
INSTALLED VERSIONS
commit : 7c48ff4
python : 3.8.1.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19041
machine : AMD64
processor : Intel64 Family 6 Model 142 Stepping 10, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : Danish_Denmark.1252
pandas : 1.2.5
numpy : 1.21.0
pytz : 2021.1
dateutil : 2.8.1
pip : 19.2.3
setuptools : 41.2.0
Cython : 0.29.23
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : 2.9.1 (dt dec pq3 ext lo64)
jinja2 : None
IPython : 7.24.1
pandas_datareader: None
bs4 : 4.9.3
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.4.2
numexpr : 2.7.3
odfpy : None
openpyxl : 3.0.7
pandas_gbq : None
pyarrow : 5.0.0
pyxlsb : None
s3fs : None
scipy : 1.7.1
sqlalchemy : 1.4.20
tables : 3.6.1
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None
The text was updated successfully, but these errors were encountered: