In [ ]:
import pandas as pd

In [ ]:
# TODO Onedrive SDK - https://github.com/onedrive/onedrive-sdk-python
excel = pd.ExcelFile('/data/docs/cabinet/Finance/money.xlsx')

In [ ]:
uktxns = excel.parse('UK')
ustxns = excel.parse('US')

In [ ]:
#Drop any transaction prior to this date
cutoffdate = '2018-01-01'

In [ ]:
def tidyxacts(df):
    df['Date'] = pd.to_datetime(df['Date'])
    df['Inflow'] = pd.to_numeric(df['Inflow'])
    df['Outflow'] = pd.to_numeric(df['Outflow'])
    df['Inflow'] = df['Inflow'].fillna(0)
    df['Outflow'] = df['Outflow'].fillna(0)
    df['Net'] = df['Inflow'] - df['Outflow']
    df.drop(['Inflow', 'Outflow'], axis=1)
    df = df[df.Date > cutoffdate]

In [ ]:
tidyxacts(uktxns)

In [ ]:
uktxns.drop(['Inflow', 'Outflow'], axis=1)

In [ ]:
gb = uktxns.groupby('Account')

In [ ]:
names = {'HSBC Current': 'Assets:UK:HSBC:Current',
         'Tesco CC': 'Liabilities:UK:Tesco',
         'Nationwide': 'Assets:UK:Nationwide', 
         zxcv brg
        }

In [ ]:
for account, group in gb:
    filename = account + "beancount"
    liability_line = '    ' + names[account] + '\n'