From 408f29ef73950bfadde2b845046e7010000cdf9c Mon Sep 17 00:00:00 2001 From: Leo Meyerovich Date: Fri, 20 Sep 2024 20:22:20 -0700 Subject: [PATCH] fix(get_indegrees): pandas 3 warning --- CHANGELOG.md | 4 ++++ graphistry/compute/ComputeMixin.py | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80b0acfa0..d01727341 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm * Narrow `use_scaler` and `use_scaler_target` typing to `ScalerType` (`Literal[...]`) vs `str` * Rename `featurize_or_get_nodes_dataframe_if_X_is_None` (and edges variant) as non-private due to being shared +### Fixed + +* get_indegrees: Fix warning https://github.com/graphistry/pygraphistry/issues/587 + ## [0.34.3 - 2024-08-03] ### Added diff --git a/graphistry/compute/ComputeMixin.py b/graphistry/compute/ComputeMixin.py index aa8fe62a3..e93373a48 100644 --- a/graphistry/compute/ComputeMixin.py +++ b/graphistry/compute/ComputeMixin.py @@ -132,8 +132,9 @@ def get_indegrees(self, col: str = "degree_in"): nodes_df = g_nodes._nodes[ [c for c in g_nodes._nodes.columns if c != col] ].merge(in_degree_df, how="left", on=g._node) - nodes_df[col].fillna(0, inplace=True) - nodes_df[col] = nodes_df[col].astype("int32") + nodes_df = nodes_df.assign(**{ + col: nodes_df[col].fillna(0).astype("int32") + }) return g.nodes(nodes_df, g_nodes._node) def get_outdegrees(self, col: str = "degree_out"):