-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Modifying dataframe with float values using .iloc and boolean indexing raises ValueError #20627
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
what exactly is not right here? can you show a result= and expected= that you think should be the case here. ideally write a test that should pass |
The code raises a |
this no longer raises |
this was fixed in #31897 (to be released in 1.1, so could also add whatsnew) 3da053c is the first new commit
|
There seems to be inconsistent behavior between updating parts of a dataframe using
.iloc
depending on whether the index is accessed using an integer list or a boolean array. This does not seem to happen if all dataframe values are integer (but still happens ifnp.nan
is replaced by7.0
). Example:Code Sample
Output is:
Problem Description
Anticipated behavior is that they should be equivalent when updating, particuarly when one considers that the return value of
.iloc
is the same. Instead, we receieveValueError: Must have equal len keys and value when setting with an iterable
.Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.4.final.0
python-bits: 64
OS: Linux
OS-release: 4.15.15-1-ARCH
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: en_US.utf8
LOCALE: en_US.UTF-8
pandas: 0.22.0
pytest: None
pip: 9.0.3
setuptools: 38.5.2
Cython: 0.25.2
numpy: 1.14.2
scipy: 1.0.0
pyarrow: None
xarray: None
IPython: 6.2.1
sphinx: None
patsy: None
dateutil: 2.7.2
pytz: 2018.3
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 2.2.0
openpyxl: None
xlrd: 1.0.0
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 1.0.1
sqlalchemy: 1.2.5
pymysql: None
psycopg2: 2.7.4 (dt dec pq3 ext lo64)
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: