-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Masking broken (or at least different) for Int64 Series #28928
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
On pandas 0.25.1 I'm having exactly the same problem |
@vanschelven very late reply, but thanks a lot for the clear report! |
Seems to be working on master. A test in |
When diving into this found the following bug. import pandas as pd
df = pd.DataFrame({"a": [3,4]}).astype("Int64")
mask = pd.Series(False, index=df.index)
df.loc[mask, "a"] = df["a"] Gives: Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pandas/pandas/core/indexing.py", line 668, in __setitem__
iloc._setitem_with_indexer(indexer, value)
File "/home/pandas/pandas/core/indexing.py", line 1792, in _setitem_with_indexer
self.obj._mgr = self.obj._mgr.setitem(indexer=indexer, value=value)
File "/home/pandas/pandas/core/internals/managers.py", line 530, in setitem
return self.apply("setitem", indexer=indexer, value=value)
File "/home/pandas/pandas/core/internals/managers.py", line 402, in apply
applied = getattr(b, f)(**kwargs)
File "/home/pandas/pandas/core/internals/blocks.py", line 1685, in setitem
check_setitem_lengths(indexer, value, self.values)
File "/home/pandas/pandas/core/indexers.py", line 152, in check_setitem_lengths
"cannot set using a list-like indexer "
ValueError: cannot set using a list-like indexer with a different length than the value While the same example, but with an additional column, b:
Does not give any error, which is the desired behaviour. Output of pd.show_versions()INSTALLED VERSIONScommit : 80ba4c4 pandas : 1.1.0.dev0+1900.g80ba4c429 |
cc @jbrockmendel this is a split path problem. Will probably be fixed with your upcoming pr concerning this |
At first glance it looks like an EA2D problem that is hidden because of separate split-path logic. |
Code Sample, a copy-pastable example if possible
Problem description
I would not expect the type of the Series to affect the masking behavior.
Output of
pd.show_versions()
[paste the output of
pd.show_versions()
here below this line]INSTALLED VERSIONS
commit: None
python: 3.6.8.final.0
python-bits: 64
OS: Linux
OS-release: 4.19.43
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
pandas: 0.24.2
pytest: 4.2.1
pip: None
setuptools: 40.8.0
Cython: None
numpy: 1.16.4
scipy: 1.2.1
pyarrow: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.8.0
pytz: 2018.9
blosc: None
bottleneck: 1.2.1
tables: 3.4.4
numexpr: 2.6.9
feather: None
matplotlib: None
openpyxl: 2.6.0
xlrd: 1.2.0
xlwt: 1.3.0
xlsxwriter: None
lxml.etree: 4.3.1
bs4: 4.7.1
html5lib: 1.0.1
sqlalchemy: 1.2.14
pymysql: None
psycopg2: None
jinja2: 2.10.1
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
gcsfs: None
The text was updated successfully, but these errors were encountered: