From cad22ac0ad9ab48701e37510711a8f38b3981012 Mon Sep 17 00:00:00 2001 From: Justin Wozniak Date: Tue, 19 Sep 2023 12:56:54 -0500 Subject: [PATCH] Handle newer Pandas (ref #123) --- Pilot1/Uno/uno_data.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Pilot1/Uno/uno_data.py b/Pilot1/Uno/uno_data.py index 9aa63b98..761a02c2 100644 --- a/Pilot1/Uno/uno_data.py +++ b/Pilot1/Uno/uno_data.py @@ -183,6 +183,12 @@ def load_combo_dose_response(fraction=True): path = get_file(DATA_URL + "ComboDrugGrowth_Nov2017.csv") df = global_cache.get(path) if df is None: + # Handle multiple Pandas APIs: + if pd.__version__ >= "1.4.0": + pandas_csv_errors = { "on_bad_lines": "warn" } + else: + pandas_csv_errors = { "error_bad_lines": False, + "warn_bad_lines": True } df = pd.read_csv( path, sep=",", @@ -211,8 +217,7 @@ def load_combo_dose_response(fraction=True): "SCREENER": str, "STUDY": str, }, - error_bad_lines=False, - warn_bad_lines=True, + **pandas_csv_errors ) global_cache[path] = df