From 1ca9a4555068f626d668279b49745529af02f549 Mon Sep 17 00:00:00 2001 From: Benjamin Bertrand Date: Wed, 8 Mar 2017 16:19:28 +0300 Subject: [PATCH] Start basic skill analysis plotting --- notes_tools/tools/skills_tools.py | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 notes_tools/tools/skills_tools.py diff --git a/notes_tools/tools/skills_tools.py b/notes_tools/tools/skills_tools.py new file mode 100644 index 0000000..3be938a --- /dev/null +++ b/notes_tools/tools/skills_tools.py @@ -0,0 +1,41 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- +# vim:fenc=utf-8 +# +# Copyright © 2017 lafrite +# +# Distributed under terms of the MIT license. + +""" +Skills are "competence" and "domaine" (which is program elements)! + +Thoses tools are made to ease their manipulation +""" + +__all__ = [] + +def count_levels(df, skill): + """ Counts Levels of skill + + :param df: dataframe with skill, Level and Trimestre columns + :param skill: "Competence" or "Domaine" + :returns: Datafram (lines -> skills and columns -> levels) + + """ + # TODO: Trimestre est arbitraire |mar. mars 7 17:55:16 EAT 2017 + return df.groupby([skill, "Level"]).count()["Trimestre"].unstack() + +def count_skill_evaluation(df, skill): + """ Count how many times the skill has been evaluated + + :param df: dataframe with skill, Level and Trimestre columns + :param skill: "Competence" or "Domaine" + + """ + return count_levels(df, skill).T.sum() + + +# ----------------------------- +# Reglages pour 'vim' +# vim:set autoindent expandtab tabstop=4 shiftwidth=4: +# cursor: 16 del