47 lines
1.7 KiB
Python
47 lines
1.7 KiB
Python
# -*- 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
|