Skip to content

Commit

Permalink
🐛 Create log column when there isn't one
Browse files Browse the repository at this point in the history
  • Loading branch information
ronaldokun committed Mar 13, 2024
1 parent d11c1ec commit b2c6e6b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions extracao/datasources/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,11 @@ def register_log(
if row_filter is None:
row_filter = pd.Series(True, index=df.index)

df['Log'] = df['Log'].astype('string', copy=False).fillna('[]')
df['Log'] = df['Log'].str.replace('^$', r'[]', regex=True)
if 'Log' not in df:
df['Log'] = '[]'
else:
df['Log'] = df['Log'].astype('string', copy=False).fillna('[]')
df['Log'] = df['Log'].str.replace('^$', r'[]', regex=True)
print(f'Logging: {processing}')
log_function = partial(Base.format_log, processing=processing, column=column)
df.loc[row_filter, 'Log'] = df.loc[row_filter].progress_apply(log_function, axis=1)
Expand Down

0 comments on commit b2c6e6b

Please sign in to comment.