Skip to content

Instantly share code, notes, and snippets.

@samkit-jain
Created December 13, 2017 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save samkit-jain/1695766968acd63dd07823814b027146 to your computer and use it in GitHub Desktop.
Save samkit-jain/1695766968acd63dd07823814b027146 to your computer and use it in GitHub Desktop.
# initializing variables
transactions = [] # list to store single row entries
d_i = index of date column # from BANK_DETAILS
p_i = index of particular column # from BANK_DETAILS
# iterate over all transactions
for v_t in valid_transactions:
# date exists in the row
if v_t[d_i] is not None:
transactions.append(v_t)
# date empty, multiline particular
else:
# add v_t's particular to last entry in transactions
transactions[-1][p_i] += v_t[p_i]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment