wow-inequalities/01-scripts/data.py

23 lines
499 B
Python
Raw Normal View History

import io
from pathlib import Path
import sys
import load_yaml
from pandas import DataFrame, read_csv
DEFAULT_YAML_PATH = Path("../02-data/intermediate/relevant")
def load(yml_path: Path | str = DEFAULT_YAML_PATH) -> DataFrame:
studies = load_yaml.from_yml(yml_path)
tsv = load_yaml.to_tsv(studies)
return read_csv(io.StringIO(tsv), sep="\t")
if __name__ == "__main__":
if len(sys.argv) == 2:
res = load(Path(sys.argv[1]))
else:
res = load()
print(res)