Skip to content
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

BUG: fix .iat assignment creates a new column #24495

Merged

Conversation

RoeiRaz
Copy link
Contributor

@RoeiRaz RoeiRaz commented Dec 30, 2018

using .iat to assign incompatible value after this change:

>>> import pandas as pd
>>> df = pd.DataFrame({"a":[0]})
>>> df
   a
0  0
>>> df.iat[0,0] = None
>>> df
    a
0 NaN

- in response to pandas-devgh-23236
- changes the fallback of .iat to .iloc on type error
@codecov
Copy link

codecov bot commented Dec 30, 2018

Codecov Report

Merging #24495 into master will decrease coverage by <.01%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #24495      +/-   ##
==========================================
- Coverage   92.31%    92.3%   -0.01%     
==========================================
  Files         166      166              
  Lines       52412    52414       +2     
==========================================
+ Hits        48382    48383       +1     
- Misses       4030     4031       +1
Flag Coverage Δ
#multiple 90.73% <66.66%> (-0.01%) ⬇️
#single 43.05% <0%> (-0.01%) ⬇️
Impacted Files Coverage Δ
pandas/core/frame.py 96.85% <66.66%> (-0.06%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1ebfd8a...9515bb7. Read the comment docs.

@codecov
Copy link

codecov bot commented Dec 30, 2018

Codecov Report

Merging #24495 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #24495      +/-   ##
==========================================
+ Coverage   92.31%   92.31%   +<.01%     
==========================================
  Files         166      166              
  Lines       52412    52402      -10     
==========================================
- Hits        48382    48373       -9     
+ Misses       4030     4029       -1
Flag Coverage Δ
#multiple 90.73% <100%> (ø) ⬆️
#single 42.83% <0%> (-0.23%) ⬇️
Impacted Files Coverage Δ
pandas/core/frame.py 96.91% <100%> (ø) ⬆️
pandas/compat/__init__.py 57.91% <0%> (-0.39%) ⬇️
pandas/core/arrays/timedeltas.py 87.42% <0%> (-0.26%) ⬇️
pandas/util/testing.py 87.68% <0%> (-0.08%) ⬇️
pandas/core/arrays/period.py 98.35% <0%> (-0.05%) ⬇️
pandas/core/indexes/datetimes.py 96.31% <0%> (-0.02%) ⬇️
pandas/core/indexes/datetimelike.py 96.22% <0%> (-0.02%) ⬇️
pandas/core/computation/ops.py 95.63% <0%> (+0.03%) ⬆️
pandas/core/indexes/base.py 96.37% <0%> (+0.09%) ⬆️
pandas/core/arrays/datetimes.py 97.91% <0%> (+0.17%) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1ebfd8a...486c25d. Read the comment docs.

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add tests from the OP. should go in pandas/tests/indexing/test_scalar.py
and a whatsnew note

@jreback jreback added Bug Indexing Related to indexing on series/frames, not to indexes themselves labels Dec 30, 2018
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small change, otherwise lgtm. ping on green.

pandas/tests/indexing/test_scalar.py Outdated Show resolved Hide resolved
@jreback jreback added this to the 0.24.0 milestone Dec 30, 2018
@jreback
Copy link
Contributor

jreback commented Dec 30, 2018

lgtm. ping on green.

@jreback jreback merged commit 75e9485 into pandas-dev:master Dec 30, 2018
@jreback
Copy link
Contributor

jreback commented Dec 30, 2018

thanks @RoeiRaz

thoo added a commit to thoo/pandas that referenced this pull request Dec 30, 2018
* upstream/master:
  REF/TST: replace capture_stdout with pytest capsys fixture (pandas-dev#24501)
  BUG: fix .iat assignment creates a new column (pandas-dev#24495)
  DOC: add checks on the returns section in the docstrings (pandas-dev#23138) (pandas-dev#23432)
  ENH: Add strings_as_fixed_length parameter for df.to_records() (pandas-dev#18146) (pandas-dev#22229)
  TST: Skip db tests unless explicitly specified in -m pattern (pandas-dev#24492)
  Mix EA into DTA/TDA; part of 24024 (pandas-dev#24502)
  DOC: Fix building of a single API document (pandas-dev#24506)
Pingviinituutti pushed a commit to Pingviinituutti/pandas that referenced this pull request Feb 28, 2019
Pingviinituutti pushed a commit to Pingviinituutti/pandas that referenced this pull request Feb 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DataFrame.iat will create new column if .iat is used to set None on int Series
2 participants