Skip to content

Commit

Permalink
Merge pull request #225 from aberges-SLAC/grep_more_ioc
Browse files Browse the repository at this point in the history
grep_more_ioc fix pandas silent downcasting spam
  • Loading branch information
aberges-SLAC authored Nov 21, 2024
2 parents 0604133 + 2005ed1 commit 614c19e
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions scripts/grep_more_ioc.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,15 +492,19 @@ def main():
# pad the disable column based on the grep_ioc output
if 'disable' not in df.columns:
df['disable'] = df.index.size*[False]
if 'disable' in df.columns:
df['disable'] = df['disable'].fillna(False).astype(bool)
# handle stupid pandas 3.0 future warnings early
with pd.option_context('future.no_silent_downcasting', True):
if 'disable' in df.columns:
df['disable'] = (df['disable'].infer_objects().fillna(False))

# Fill the NaN with empty strings for rarely used keys
for _col in df.columns:
if _col not in ['delay']:
df[_col] = df[_col].fillna('')
else:
df[_col] = df[_col].fillna(0)
# handle stupid pandas 3.0 future warnings early
with pd.option_context('future.no_silent_downcasting', True):
for _col in df.columns:
if _col not in ['delay']:
df[_col] = df[_col].infer_objects().fillna('')
else:
df[_col] = df[_col].infer_objects().fillna(0)

# check for the ignore_disabled flag
if args.ignore_disabled is True:
Expand Down

0 comments on commit 614c19e

Please sign in to comment.