k_means_clust - change to remove warning (#10244)

* Replacing the generator with numpy vector operations from lu_decomposition.

* Revert "Replacing the generator with numpy vector operations from lu_decomposition."

This reverts commit ad217c6616.

* the change removes the warning:
/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(
This commit is contained in:
Kamil 2023-10-11 01:18:31 +05:00 committed by GitHub
parent 9a5a6c663c
commit 0070739233
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -235,7 +235,7 @@ def report_generator(
] # group by cluster number ] # group by cluster number
.agg( .agg(
[ [
("sum", np.sum), ("sum", "sum"),
("mean_with_zeros", lambda x: np.mean(np.nan_to_num(x))), ("mean_with_zeros", lambda x: np.mean(np.nan_to_num(x))),
("mean_without_zeros", lambda x: x.replace(0, np.NaN).mean()), ("mean_without_zeros", lambda x: x.replace(0, np.NaN).mean()),
( (
@ -248,7 +248,7 @@ def report_generator(
) )
), ),
), ),
("mean_with_na", np.mean), ("mean_with_na", "mean"),
("min", lambda x: x.min()), ("min", lambda x: x.min()),
("5%", lambda x: x.quantile(0.05)), ("5%", lambda x: x.quantile(0.05)),
("25%", lambda x: x.quantile(0.25)), ("25%", lambda x: x.quantile(0.25)),