From 38099c33588bd709b9315dd416e5d5b811bc73ca Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Thu, 14 Dec 2023 18:06:39 +0100 Subject: [PATCH] feat(code): Output data as csv to stdout on script run When running data python script (`src/data.py`) directly through the command line, we now use pandas to output the collected data directly as a csv to stdout. Can then be redirected to e.g. a file to save the data in csv format. --- src/data.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/data.py b/src/data.py index 4ac0fb4..d74fe92 100644 --- a/src/data.py +++ b/src/data.py @@ -39,6 +39,8 @@ if __name__ == "__main__": else: res = from_yml() - print(res) - # print out tsv file instead - # print(to_tsv(load_yaml.load(DEFAULT_YAML_PATH))) + from io import StringIO + output = StringIO() + res.to_csv(output) + output.seek(0) + print(output.read())