frugal_cviz / src /eda.py
sycod
data ok and EDA begun
a03ee84
Raw History Blame Contribute Delete
785 Bytes
"""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()