From 915d4059a767addfba74e294eee51317d3fc5d8e Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sat, 11 Dec 2021 12:39:53 +0100 Subject: [PATCH] =?UTF-8?q?fichier=20oubli=C3=A9=20dans=20le=20commit=20pr?= =?UTF-8?q?=C3=A9c=C3=A9dent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/comp/moy_sem.py | 46 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 app/comp/moy_sem.py diff --git a/app/comp/moy_sem.py b/app/comp/moy_sem.py new file mode 100644 index 00000000..ef87f9e9 --- /dev/null +++ b/app/comp/moy_sem.py @@ -0,0 +1,46 @@ +# -*- mode: python -*- +# -*- coding: utf-8 -*- + +############################################################################## +# +# Gestion scolarite IUT +# +# Copyright (c) 1999 - 2021 Emmanuel Viennet. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# Emmanuel Viennet emmanuel.viennet@viennet.net +# +############################################################################## + +"""Fonctions de calcul des moyennes de semestre (indicatives dans le BUT) +""" +import numpy as np +import pandas as pd + + +def compute_sem_moys(etud_moy_ue_df, modimpl_coefs_df): + """Calcule la moyenne générale indicative + = moyenne des moyennes d'UE, pondérée par la somme de leurs coefs + + etud_moy_ue_df: DataFrame, colonnes ue_id, lignes etudid + modimpl_coefs_df: DataFrame, colonnes moduleimpl_id, lignes UE + + Result: panda Series, index etudid, valeur float (moyenne générale) + """ + moy_gen = (etud_moy_ue_df * modimpl_coefs_df.values.sum(axis=1)).sum( + axis=1 + ) / modimpl_coefs_df.values.sum() + return moy_gen