Start basic skill analysis plotting

This commit is contained in:
Benjamin Bertrand 2017-03-08 16:19:28 +03:00
parent b543e15f59
commit 1ca9a45550
1 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,41 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2017 lafrite <lafrite@Poivre>
#
# 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