diff --git a/chimet-scraper.py b/chimet-scraper.py index fdb17b32fbe687f8cb926e0cf13e7cbc8f6e507a..1563229de6fb506443ad4a889cfc63b8d99324fc 100644 --- a/chimet-scraper.py +++ b/chimet-scraper.py @@ -182,6 +182,20 @@ def daterange(from_time, to_time) -> typing.List[datetime.datetime]: return dates +def uppercase_columns(pandas_dataset): + """Makes sure all the column names are uppercase + + Arguments: + pandas_dataset: + The dataset to uppercase column names of. + Warning, this modifies this object. + + Returns: + The dataset with uppercase column names. + """ + pandas_dataset.columns = pandas_dataset.columns.str.upper() + return pandas_dataset + def combine_csvs(input_csv_files: list, output_loc): """Combines the given csv files into one big one. @@ -191,7 +205,8 @@ def combine_csvs(input_csv_files: list, output_loc): input_csv_files: The list of csv files to combine. output_loc: Where the save the combined csv file. """ - combined = pd.concat([pd.read_csv(f) for f in input_csv_files]) + combined = pd.concat([uppercase_columns(pd.read_csv(f)) + for f in input_csv_files]) combined.to_csv(output_loc, index=False, encoding='utf-8') def make_csv(location: Locations,