Skip to content

Commit

Permalink
Merge pull request #550 from patgo25/fix_pandas_future_warnings
Browse files Browse the repository at this point in the history
Fix pandas future deprecations
  • Loading branch information
gipert authored Jan 23, 2024
2 parents 263052f + bc183a5 commit 7eacdd8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ install_requires =
numpy>=1.21
pandas>=1.4.4
pint
pyarrow
scikit-learn
scipy>=1.0.1
tables
Expand Down
10 changes: 8 additions & 2 deletions src/pygama/flow/file_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,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)
Expand Down Expand Up @@ -669,7 +672,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.
Expand Down

0 comments on commit 7eacdd8

Please sign in to comment.