File size: 785 Bytes
a03ee84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""Load dataset and save locally in selected format"""

import logging
import os
import pandas as pd
import yaml


# Logging configuration (see all outputs, even DEBUG or INFO)
logger = logging.getLogger()
logger.setLevel(logging.INFO)

# local config
with open("config.yaml", "r") as f:
    cfg = yaml.safe_load(f)


def make_autopct(values):
    """
    ==> Obtained from StackOverflow <==
    Upgrades plt.pie(autopct=""), displaying percentages and values.

    Input: list of numeric values or Pandas.Series
    Output: string with percentage and value
    """

    def my_autopct(pct):
        total = sum(values)
        val = int(round(pct * total / 100.0))
        return "{p:.2f}%  ({v:d})".format(p=pct, v=val)

    return my_autopct


if __name__ == "__main__":
    help()