From a85ca9dff4d695e289d7495dd321fa2c2a9bc287 Mon Sep 17 00:00:00 2001 From: Sam Gamble Date: Thu, 28 Nov 2024 12:22:31 +0000 Subject: [PATCH] Added Stephanes script to switch quouting --- utils/switch-quoting.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 utils/switch-quoting.py diff --git a/utils/switch-quoting.py b/utils/switch-quoting.py new file mode 100755 index 00000000..e1905ade --- /dev/null +++ b/utils/switch-quoting.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python + +import pandas as pd +import csv +from pathlib import Path + +# add quoting switch => csv.QUOTE_MINIMAL // csv.QUOTE_ALL +oed_root_path = Path(Path(__file__).parent.parent, "OpenExposureData") +oed_files = list(oed_root_path.glob('*.csv')) + +for filename in oed_files: + df = pd.read_csv(filename, dtype=str, na_values=[], keep_default_na=False) + df.to_csv(filename, index=False, quoting=csv.QUOTE_MINIMAL)