Skip to content

DEPR: method, limit in NDFrame.replace #53492

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 9 commits into from
Jun 14, 2023

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

xref #33302

@mroeschke mroeschke added Deprecate Functionality to remove in pandas replace replace method labels Jun 1, 2023
warnings.warn(
# GH#33302
f"The 'method' keyword in {type(self).__name__}.replace is "
"deprecated and will be removed in a future version.",
Copy link
Member

Choose a reason for hiding this comment

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

Is there any way to specify "do X instead"?

Copy link
Member Author

Choose a reason for hiding this comment

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

if there are no nans you can do obj.replace(value, np.nan).fillna(method=method), but that messes up with nans. really i think this is just a really weird use case.

Copy link
Member

Choose a reason for hiding this comment

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

Okay sounds good. Just a merge conflict it appears

Copy link
Member

@mroeschke mroeschke left a comment

Choose a reason for hiding this comment

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

One more merge conflict otherwise looks good

@jbrockmendel
Copy link
Member Author

rebased + green

@mroeschke mroeschke added this to the 2.1 milestone Jun 14, 2023
@mroeschke mroeschke merged commit 8893c38 into pandas-dev:main Jun 14, 2023
@mroeschke
Copy link
Member

Thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the depr-replace-method branch June 14, 2023 17:15
mroeschke pushed a commit to mroeschke/pandas that referenced this pull request Jun 15, 2023
* DEPR: method, limit in NDFrame.replace

* update test, docs

* suppress doctest warning

* doctests
mroeschke added a commit that referenced this pull request Jun 21, 2023
* CI: Build pandas even if doctests fail

* BUG: groupby sum turning `inf+inf` and `(-inf)+(-inf)` into `nan` (#53623)

* DEPR: method, limit in NDFrame.replace (#53492)

* DEPR: method, limit in NDFrame.replace

* update test, docs

* suppress doctest warning

* doctests

* PERF: Series.str.get_dummies for ArrowDtype(pa.string()) (#53655)

* PERF: Series.str.get_dummies for ArrowDtype(pa.string())

* whatsnew

* typing

* TYP: core.missing (#53625)

* CI: Attempt to fix wheel builds (#53670)

* DOC: Fixing EX01 - Added examples (#53647)

* SeriesGroupBy.fillna example added

* Added examples

* Corrected failing test for timedelta.total_seconds

* Corrected fillna example

* CI/TST: Mark test_to_read_gcs as single_cpu (#53677)

* BUG/CoW: is_range_indexer can't handle very large arrays (#53672)

* BUG: is_range_indexer can't handle very large arrays

* fix test on 32-bit

* TST: Use more pytest fixtures

---------

Co-authored-by: Yao Xiao <108576690+Charlie-XIAO@users.noreply.github.com>
Co-authored-by: jbrockmendel <jbrockmendel@gmail.com>
Co-authored-by: Luke Manley <lukemanley@gmail.com>
Co-authored-by: Thomas Li <47963215+lithomas1@users.noreply.github.com>
Co-authored-by: Dea María Léon <deamarialeon@gmail.com>
Daquisu pushed a commit to Daquisu/pandas that referenced this pull request Jul 8, 2023
* DEPR: method, limit in NDFrame.replace

* update test, docs

* suppress doctest warning

* doctests
Daquisu pushed a commit to Daquisu/pandas that referenced this pull request Jul 8, 2023
* CI: Build pandas even if doctests fail

* BUG: groupby sum turning `inf+inf` and `(-inf)+(-inf)` into `nan` (pandas-dev#53623)

* DEPR: method, limit in NDFrame.replace (pandas-dev#53492)

* DEPR: method, limit in NDFrame.replace

* update test, docs

* suppress doctest warning

* doctests

* PERF: Series.str.get_dummies for ArrowDtype(pa.string()) (pandas-dev#53655)

* PERF: Series.str.get_dummies for ArrowDtype(pa.string())

* whatsnew

* typing

* TYP: core.missing (pandas-dev#53625)

* CI: Attempt to fix wheel builds (pandas-dev#53670)

* DOC: Fixing EX01 - Added examples (pandas-dev#53647)

* SeriesGroupBy.fillna example added

* Added examples

* Corrected failing test for timedelta.total_seconds

* Corrected fillna example

* CI/TST: Mark test_to_read_gcs as single_cpu (pandas-dev#53677)

* BUG/CoW: is_range_indexer can't handle very large arrays (pandas-dev#53672)

* BUG: is_range_indexer can't handle very large arrays

* fix test on 32-bit

* TST: Use more pytest fixtures

---------

Co-authored-by: Yao Xiao <108576690+Charlie-XIAO@users.noreply.github.com>
Co-authored-by: jbrockmendel <jbrockmendel@gmail.com>
Co-authored-by: Luke Manley <lukemanley@gmail.com>
Co-authored-by: Thomas Li <47963215+lithomas1@users.noreply.github.com>
Co-authored-by: Dea María Léon <deamarialeon@gmail.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Deprecate Functionality to remove in pandas replace replace method
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants