From 0f539a4fcd72517c1eecd8d8a774ccee1c191322 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 28 Nov 2022 10:03:28 +0100 Subject: [PATCH] Suppress warning on 0/0 in compute_mat_moys_classic --- app/comp/moy_ue.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/comp/moy_ue.py b/app/comp/moy_ue.py index a5d9077ec..698851e11 100644 --- a/app/comp/moy_ue.py +++ b/app/comp/moy_ue.py @@ -466,9 +466,10 @@ def compute_mat_moys_classic( if modimpl_coefs_etuds_no_nan.dtype == object: # arrive sur des tableaux vides modimpl_coefs_etuds_no_nan = modimpl_coefs_etuds_no_nan.astype(np.float) - etud_moy_mat = (modimpl_coefs_etuds_no_nan * sem_matrix_inscrits).sum( - axis=1 - ) / modimpl_coefs_etuds_no_nan.sum(axis=1) + with np.errstate(invalid="ignore"): # il peut y avoir des NaN + etud_moy_mat = (modimpl_coefs_etuds_no_nan * sem_matrix_inscrits).sum( + axis=1 + ) / modimpl_coefs_etuds_no_nan.sum(axis=1) return pd.Series(etud_moy_mat, index=modimpl_inscr_df.index)