Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grep_more_ioc fix pandas silent downcasting spam #225

Merged
merged 2 commits into from
Nov 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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