Python: Pandas inplace=True deprecated

Open Beginner friendly
#2,802 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
pandas, python
Domain
data

Research direction

Start by reading the six reported locations in python/prophet/forecaster.py, python/prophet/make_holidays.py, and python/prophet/metrics.py, then check how each DataFrame method's result is used. Replace the deprecated inplace=True calls with assigned results, and run the relevant Python tests to confirm they pass without the deprecation warnings.

Written by the indexing model from the issue text.

Description

The use of inplace=True in Pandas DataFrame method's is being deprecated, already start causing warnings.

pandas.errors.Pandas4Warning: The inplace keyword in DataFrame.drop is deprecated and will be removed in a future version (PDEP-8).
See https://pandas.pydata.org/docs/dev/whatsnew/v3.1.0.html#deprecation-inplace for more details.

The following are the affected lines that I could find at first glance on the main branch. In all cases, the inplace-writing of dataframes is not necessary and can be replaced by df = df.some_method() without the inplace argument.

https://github.com/meta/prophet/blob/573a00da313d2e73c15ffe0cb4e04ec5f35b4b91/python/prophet/forecaster.py#L608

https://github.com/meta/prophet/blob/573a00da313d2e73c15ffe0cb4e04ec5f35b4b91/python/prophet/forecaster.py#L627

https://github.com/meta/prophet/blob/573a00da313d2e73c15ffe0cb4e04ec5f35b4b91/python/prophet/forecaster.py#L1105

https://github.com/meta/prophet/blob/573a00da313d2e73c15ffe0cb4e04ec5f35b4b91/python/prophet/make_holidays.py#L78

https://github.com/meta/prophet/blob/573a00da313d2e73c15ffe0cb4e04ec5f35b4b91/python/prophet/metrics.py#L113

https://github.com/meta/prophet/blob/573a00da313d2e73c15ffe0cb4e04ec5f35b4b91/python/prophet/metrics.py#L284

Dominant language
Python
Stars
20.5k
Forks
4.6k
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from facebook/prophet

All issues in facebook/prophet

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.