Skip to content
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

[BUG] pandas 3.0 warning #587

Open
lmeyerov opened this issue Sep 21, 2024 · 0 comments · Fixed by #588
Open

[BUG] pandas 3.0 warning #587

lmeyerov opened this issue Sep 21, 2024 · 0 comments · Fixed by #588
Assignees
Labels

Comments

@lmeyerov
Copy link
Contributor

Describe the bug

Triggered this warning in materialize_nodes() in pandas 2.2.2

/opt/conda/lib/python3.10/site-packages/graphistry/compute/ComputeMixin.py:135: 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.


  nodes_df[col].fillna(0, inplace=True)
/opt/conda/lib/python3.10/site-packages/graphistry/compute/ComputeMixin.py:135: 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.


  nodes_df[col].fillna(0, inplace=True)

Relevant line:

nodes_df[col].fillna(0, inplace=True)

To Reproduce

import graphistry
import pandas as pd
edf = pd.DataFrame({
    's': ['a1', 'b2'],
    'd': ['b2', 'c1']
})
g = graphistry.edges(edf, 's', 'd').materialize_nodes().get_degrees()
g._nodes

Expected behavior

No warning

Actual behavior

Warning

Graphistry GPU server environment
Pandas 2.2, PyGraphistry 0.34.3

@lmeyerov lmeyerov self-assigned this Sep 21, 2024
@lmeyerov lmeyerov linked a pull request Sep 21, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant