Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: Pandas 3.0 warning for inplace method#642

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
bednar merged 3 commits intoinfluxdata:masterfromlars20070:fixpandas3warning
Feb 6, 2024

Conversation

lars20070
Copy link
Contributor

@lars20070lars20070 commentedFeb 2, 2024
edited
Loading

Related#637

Proposed Changes

Currently, the following warning for inplace methods in the upcoming Pandas 3.0 is triggered.

~/.venv/lib/python3.11/site-packages/influxdb_client/client/write/dataframe_serializer.py:237: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method.The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.

The pull request silences the warning.

Checklist

  • CHANGELOG.md updated
  • Rebased/mergeable
  • pytest tests completes successfully
  • Commit messages areconventional
  • SignCLA (if not already signed)

@lars20070lars20070 changed the titlesilence pandas 3.0 warningfix Pandas 3.0 warning for inplace methodFeb 3, 2024
@lars20070lars20070 changed the titlefix Pandas 3.0 warning for inplace methodfix: Pandas 3.0 warning for inplace methodFeb 3, 2024
Copy link
Contributor

@bednarbednar left a comment

Choose a reason for hiding this comment

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

Hi@lars20070, first off, thank you for your contribution through the PR, it's greatly appreciated! 👍

Could you please explain why Pandas recommends using the syntax:For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)'?

It seems our sources employ this recommended syntax.

Best Regards

@lars20070
Copy link
ContributorAuthor

Hi@bednar, Pandas is currently in version 2.2 with3.0 scheduled for April 2024. No, I cannot explain why Pandas triggered the warning. But you might be on the safe side using option 2 and be prepared for the upcoming breaking changes. I can see your#638 changes but still get the warning from this line.

Copy link
Contributor

@bednarbednar left a comment

Choose a reason for hiding this comment

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

Hi@lars20070,

Thank you for your thorough explanation and for aligning your solution with best practices recommended by Pandas.

Before we proceed to merge your PR, could you please ensure that all items on our project's Checklist are satisfied?

image

After that we are be able to merge this PR.

Thanks again for your contribution 👍

@lars20070
Copy link
ContributorAuthor

lars20070 commentedFeb 5, 2024
edited
Loading

@bednar I struggle a bit to understand your setup. I am more familiar with Poetry projects. I would appreciate your input.

  • I have updated theCHANGELOG.md.
  • I forked yesterday. So no need to rebase. I see no merge conflicts.
  • pytest seems to pass. I see no failing tests.
  • Guess my commit message was not quite conventional.

Can you please explain what changes in the code are needed. I cannot see any merge conflicts or failing tests. Thanks.

@bednar
Copy link
Contributor

@lars20070, please sign the CLA and check the checkbox so we can proceed with merging your PR.

@lars20070
Copy link
ContributorAuthor

Signed. Thanks@bednar.

Copy link
Contributor

@bednarbednar left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@lars20070
Copy link
ContributorAuthor

On a totally unrelated note. Any chance of looking intothis issue?
Apologies for cross-posting.

@bednar
Copy link
Contributor

@lars20070 unfurnetally I don't know anything aboutvsflux... I am at JetBrains IDEs ;)

lars20070 reacted with thumbs up emoji

@bednarbednar merged commited89701 intoinfluxdata:masterFeb 6, 2024
@bednarbednar added this to the1.41.0 milestoneFeb 6, 2024
@lars20070lars20070 deleted the fixpandas3warning branchFebruary 6, 2024 07:05
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@bednarbednarbednar approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
1.41.0
Development

Successfully merging this pull request may close these issues.

2 participants
@lars20070@bednar

[8]ページ先頭

©2009-2025 Movatter.jp