repytex/notes_tools/tools/skills_tools.py

42 lines
1.0 KiB
Python
Raw Normal View History

2017-03-08 13:19:28 +00:00
#! /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