Skip to content

Commit

Permalink
ingest: drop all unmapped columns at once, which is much faster
Browse files Browse the repository at this point in the history
  • Loading branch information
pcoccoli committed Oct 30, 2023
1 parent 797f1cd commit fc05669
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion firepit/aio/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ def translate(
# columns we need to "unwrap"
unwrap = set()

# "Unmapped" columns that we need to drop
unmapped = []

logger.debug('columns: %s', cols)
for col in cols:
logger.debug('column: %s', col)
Expand Down Expand Up @@ -298,7 +301,10 @@ def translate(
else:
# Drop unmapped columns
logger.debug('DROP unmapped column "%s"', col)
df = df.drop(col, axis=1)
unmapped.append(col)

# Drop any columns that weren't mapped
df = df.drop(unmapped, axis=1)

# Run transformers
for txf_col, txf_name in txf_cols.items():
Expand Down

0 comments on commit fc05669

Please sign in to comment.