Skip to content

Commit

Permalink
the change removes the warning:
Browse files Browse the repository at this point in the history
/home/runner/work/Python/Python/machine_learning/k_means_clust.py:236: FutureWarning: The provided callable <function sum at 0x7f20c02034c0> is currently using SeriesGroupBy.sum. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string "sum" instead.
     .agg(

And

/home/runner/work/Python/Python/machine_learning/k_means_clust.py:236: FutureWarning: The provided callable <function mean at 0x7f3d7db1c5e0> is currently using SeriesGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string "mean" instead.
     .agg(
  • Loading branch information
quant12345 committed Oct 10, 2023
1 parent 4e34723 commit 625938d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions machine_learning/k_means_clust.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def report_generator(
] # group by cluster number
.agg(
[
("sum", np.sum),
("sum", "sum"),
("mean_with_zeros", lambda x: np.mean(np.nan_to_num(x))),
("mean_without_zeros", lambda x: x.replace(0, np.NaN).mean()),
(
Expand All @@ -248,7 +248,7 @@ def report_generator(
)
),
),
("mean_with_na", np.mean),
("mean_with_na", "mean"),
("min", lambda x: x.min()),
("5%", lambda x: x.quantile(0.05)),
("25%", lambda x: x.quantile(0.25)),
Expand Down

0 comments on commit 625938d

Please sign in to comment.