Skip to content

Instantly share code, notes, and snippets.

View samkit-jain's full-sized avatar
👨‍💻
Honing my craft

Samkit Jain samkit-jain

👨‍💻
Honing my craft
View GitHub Profile
#!/usr/bin/env bash
set -xe
# install packages and dependencies
go get github.com/dgrijalva/jwt-go
# build command
go build -o bin/application application.go
# initializing variables
w_i = index of withdrawal column # from BANK_DETAILS
d_i = index of deposit column # from BANK_DETAILS
b_i = index of balance column # from BANK_DETAILS
is_negative = False # flag for default checking
final_result = [] # transactions with label assigned
# iterate over all transactions
for transaction in transactions:
# debit leading to a negative balance
# reading table using tabula
rows = tabula.read_pdf(filepath,
pages='all',
silent=True,
pandas_options={
'header': None,
'error_bad_lines': False,
'warn_bad_lines': False
})
# converting to list
# 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)
# ----- get header row ----- #
# list to contain all headers
headers = []
# iterate over all rows
for row in rows:
if last column empty:
headers.append(rows)
else:
BANK_DETAILS = {
'HDFC': {
'particulars': 1, # index of particulars column
'withdrawal': 4, # index of withdrawal column
'deposit': 5, # index of deposit column
'balance': 6, # index of balance column
'date': 0, # index of date column
'chq': 2, # index of cheque no. column
'value_date': 3 # index of value date column
},
# method to categorize a particular
def categorize(particular):
# tokenizing
word_list = tokenize(particular)
# multiple similar statements
if keyword in word_list:
return category
# iterate over all transactions