Download src/eda.py from sycod/frugal_cviz: direct link, hf CLI and curl.
- Browser
- Download file 785 Bytes
-
https://huggingface.co/sycod/frugal_cviz/resolve/main/src/eda.py
- Command line
-
hf download hf://sycod/frugal_cviz/src/eda.py
-
curl -L -o eda.py https://huggingface.co/sycod/frugal_cviz/resolve/main/src/eda.py
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() | |