From b7471bc941e3e5538384deace2c9771b0ca3ab25 Mon Sep 17 00:00:00 2001 From: Patrick Krause Date: Tue, 23 Jan 2024 12:17:09 +0100 Subject: [PATCH] error parameter deprecation in pandas 2.2 to_numeric function --- src/pygama/flow/file_db.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/pygama/flow/file_db.py b/src/pygama/flow/file_db.py index c64e6b786..703807be6 100644 --- a/src/pygama/flow/file_db.py +++ b/src/pygama/flow/file_db.py @@ -274,7 +274,10 @@ def scan_files(self, dirs: list[str] = None) -> None: # convert cols to numeric dtypes where possible for col in self.df.columns: - self.df[col] = pd.to_numeric(self.df[col], errors="ignore") + try: + self.df[col] = pd.to_numeric(self.df[col]) + except ValueError: + continue # sort rows according to timestamps utils.inplace_sort(self.df, self.sortby) @@ -673,7 +676,10 @@ def scan_daq_files(self, daq_dir: str, daq_template: str) -> None: # convert cols to numeric dtypes where possible for col in self.df.columns: - self.df[col] = pd.to_numeric(self.df[col], errors="ignore") + try: + self.df[col] = pd.to_numeric(self.df[col]) + except ValueError: + continue def get_table_name(self, tier: str, tb: str) -> str: """Get the table name for a tier given its table identifier.