Skip to content

Instantly share code, notes, and snippets.

@hsyyid
Created August 25, 2020 19:52
Show Gist options
  • Save hsyyid/b31bd5702816b79954d55c859c3803df to your computer and use it in GitHub Desktop.
Save hsyyid/b31bd5702816b79954d55c859c3803df to your computer and use it in GitHub Desktop.
# Specify lookup keys
qb_lookup_keys = {'key_prop': 'name', 'value_prop': 'value'}
# Explode these into new columns
invoices = (invoices.pipe(gs.json_tuple_to_cols, 'Line.SalesItemLineDetail.ItemRef',
col_config={'cols': {'key_prop': 'Item', 'value_prop': 'Item Id'},
'look_up': qb_lookup_keys})
.pipe(gs.json_tuple_to_cols, 'Line.SalesItemLineDetail.ItemAccountRef',
col_config={'cols': {'key_prop': 'Item Ref', 'value_prop': 'Item Ref Id'},
'look_up': qb_lookup_keys}))
invoices[['Id', 'Item', 'Item Id', 'Item Ref', 'Item Ref Id']].head()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment