Skip to content

BUG: replace with value also being replaced #46335

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

Merged
merged 5 commits into from
Mar 12, 2022
Merged

Conversation

lukemanley
Copy link
Member

@lukemanley lukemanley commented Mar 12, 2022

@lukemanley lukemanley added Bug Regression Functionality that used to work in a prior pandas version replace replace method labels Mar 12, 2022
@jreback jreback added this to the 1.4.2 milestone Mar 12, 2022
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.

lgtm, can you add a whatsnew note in regression section of 1.4.2 and ping on green.

type(self).replace, to_replace, value, inplace=True
)
blocks = []
nbs = self._split()
Copy link
Contributor

Choose a reason for hiding this comment

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

could write this entire section as a list-comprehension, but maybe not as readable

Copy link
Member Author

Choose a reason for hiding this comment

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

good idea, i like the list comprehension better

Copy link
Member Author

Choose a reason for hiding this comment

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

Went back to a non-list comprehension implementation as it requires unpacking.

@lukemanley
Copy link
Member Author

@jreback - greenish

@jreback jreback merged commit 0be6fd3 into pandas-dev:main Mar 12, 2022
@jreback
Copy link
Contributor

jreback commented Mar 12, 2022

@meeseeksdev backport 1.4.x

@lumberbot-app
Copy link

lumberbot-app bot commented Mar 12, 2022

Something went wrong ... Please have a look at my logs.

simonjayhawkins pushed a commit that referenced this pull request Mar 12, 2022
@@ -18,6 +18,7 @@ Fixed regressions
- Fixed regression in :func:`read_csv` killing python process when invalid file input was given for ``engine="c"`` (:issue:`45957`)
- Fixed memory performance regression in :meth:`Series.fillna` when called on a :class:`DataFrame` column with ``inplace=True`` (:issue:`46149`)
- Provided an alternative solution for passing custom Excel formats in :meth:`.Styler.to_excel`, which was a regression based on stricter CSS validation. Examples available in the documentation for :meth:`.Styler.format` (:issue:`46152`)
- Fixed regression in :meth:`DataFrame.replace` when a replacement value was also a target for replacement (:issue:`46335`)
Copy link
Member

Choose a reason for hiding this comment

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

will change the issue number to #46306 in a release note tidy up

Copy link
Member

Choose a reason for hiding this comment

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

done in #46354

jbrockmendel pushed a commit to jbrockmendel/pandas that referenced this pull request Mar 16, 2022
@lukemanley lukemanley deleted the GH46306 branch March 20, 2022 23:18
yehoshuadimarsky pushed a commit to yehoshuadimarsky/pandas that referenced this pull request Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Regression Functionality that used to work in a prior pandas version replace replace method
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: replace method with np.nan produces incorrect results
3 participants