From 216339eacbabcb180612e67fcbd9ce72d03393a2 Mon Sep 17 00:00:00 2001 From: Joakim Pettersson <joakim.pettersson@join.se> Date: Thu, 19 Sep 2024 16:21:56 +0200 Subject: [PATCH] Speedup read_excel for SMHI data #682 This shaved off 6 seconds from the test. * Use calamine when importing SMHI data --- data/issues/emissions/historical_data_calculations.py | 2 +- data/requirements.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/data/issues/emissions/historical_data_calculations.py b/data/issues/emissions/historical_data_calculations.py index 7399dd67..a6669d2f 100644 --- a/data/issues/emissions/historical_data_calculations.py +++ b/data/issues/emissions/historical_data_calculations.py @@ -12,7 +12,7 @@ def get_smhi_data(): pandas.DataFrame: The dataframe containing the SMHI data. """ - df_raw = pd.read_excel(PATH_SMHI) + df_raw = pd.read_excel(PATH_SMHI, engine="calamine") # Remove the first 4 rows and reset the index df_raw = df_raw.drop([0, 1, 2]).reset_index(drop=True) diff --git a/data/requirements.txt b/data/requirements.txt index 054ac325..dd716849 100644 --- a/data/requirements.txt +++ b/data/requirements.txt @@ -7,3 +7,4 @@ scipy pytest pytest-profiling graphviz +python-calamine