Skip to content

BUG: Support empty dict-likes in replace() #15294

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

Closed
wants to merge 1 commit into from

Conversation

ExpHP
Copy link
Contributor

@ExpHP ExpHP commented Feb 2, 2017

@jreback jreback added Bug Reshaping Concat, Merge/Join, Stack/Unstack, Explode labels Feb 2, 2017
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.

some trivial changes. lgtm. ping on green.

@@ -1055,3 +1055,12 @@ def test_replace_datetimetz(self):
Timestamp('20130103', tz='US/Eastern')],
'B': [0, np.nan, 2]})
assert_frame_equal(result, expected)

def test_replace_with_empty_dictlike(self):
mix = {'a': lrange(4), 'b': list('ab..'), 'c': ['a', 'b', nan, 'd']}
Copy link
Contributor

Choose a reason for hiding this comment

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

add the issue number in a comment

@@ -223,3 +223,8 @@ def test_replace2(self):
self.assertTrue((ser[:5] == -1).all())
self.assertTrue((ser[6:10] == -1).all())
self.assertTrue((ser[20:30] == -1).all())

def test_replace_with_empty_dictlike(self):
s = pd.Series(list('abcd'))
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

@jreback jreback added this to the 0.20.0 milestone Feb 2, 2017
@codecov-io
Copy link

Codecov Report

Merging #15294 into master will not impact coverage.

@@           Coverage Diff           @@
##           master   #15294   +/-   ##
=======================================
  Coverage   86.33%   86.33%           
=======================================
  Files         139      139           
  Lines       51149    51149           
=======================================
  Hits        44157    44157           
  Misses       6992     6992
Impacted Files Coverage Δ
pandas/core/generic.py 96.33% <100%> (ø)

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 8452080...f349e0a. Read the comment docs.

@jreback jreback closed this in f6cfaab Feb 2, 2017
@jreback
Copy link
Contributor

jreback commented Feb 2, 2017

thanks @ExpHP nice PR!

AnkurDedania pushed a commit to AnkurDedania/pandas that referenced this pull request Mar 21, 2017
closes pandas-dev#15289

Author: Michael Lamparski <[email protected]>

Closes pandas-dev#15294 from ExpHP/bugfix-15289 and squashes the following commits:

f349e0a [Michael Lamparski] BUG: Support empty dict-likes in replace()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

series.replace with empty dictlike raises ValueError: not enough values to unpack
3 participants