Skip to content

Replace deprecated pandas inplace DataFrame calls - #3010

Open
mraviraz wants to merge 8 commits into
ranaroussi:devfrom
mraviraz:fix/pandas-31-deprecation-warnings
Open

mraviraz wants to merge 8 commits into
ranaroussi:devfrom
mraviraz:fix/pandas-31-deprecation-warnings

Conversation

@mraviraz

Copy link
Copy Markdown

Addresses #3009

Replace DataFrame operations using inplace=True with assignments to the returned DataFrame across eight modules. This addresses the Pandas 3.1 deprecation warnings while preserving each transformation order.

  • 29 calls updated
  • Tests not run

@ValueRaider

Copy link
Copy Markdown
Collaborator

git squash

@arhancanli

Copy link
Copy Markdown

Checked this on the branch (f5764de) against master with pandas 3.x on Python 3.12. I turned warnings into errors (warnings.simplefilter('error')) and ran utils.auto_adjust, utils.back_adjust and utils.parse_actions on a small synthetic frame and event payload: master raises the Pandas4Warning on set_index/sort_index, the branch runs clean, and the outputs are identical (same columns, same adjusted Close, same Dividends/Stock Splits frames). grep -rn inplace yfinance/ on the branch returns nothing, so no call was missed.

On whether any caller relied on the in-place mutation: auto_adjust/back_adjust work on data.copy() and the only callers in scrapers/history.py reassign (df = utils.auto_adjust(df)), so that one is safe. I only exercised the utils paths, not the scraper modules (holders, calendars, multi), which need network or fixtures; the full test suite was not run.

@apoptosis66

Copy link
Copy Markdown

Yes please, sooner than later.

@ValueRaider

ValueRaider commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

This isn't merging without a git squash. Someone take over

@apoptosis66

Copy link
Copy Markdown

squash with what? What other PRs do you want it squashed with?

@arhancanli

This comment was marked as low quality.

@apoptosis66

Copy link
Copy Markdown

At the risk of sounding dumb. I tried to do as you suggested and squash into a new pr. I just don't know what I am doing with git/github. Sorry I am 20 year svn user. :) When I was done I had a pr that had way more commits in it than the original 8. Someone else is going to have to do it.

@arhancanli

This comment was marked as low quality.

@ValueRaider

Copy link
Copy Markdown
Collaborator

Drop the AI slop. Just link to the docs https://ranaroussi.github.io/yfinance/development/code.html

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants