aniav / ynab-csv

Tool for making your CSV files ready to import into YNAB
https://aniav.github.io/ynab-csv/
MIT License
164 stars 84 forks source link

Option to set different payee for inflow and outflow #60

Open jannesii opened 1 year ago

jannesii commented 1 year ago

In my bank's csv there is column 'F' titled 'receiver's name' and column 'E' titled 'payer'. Selecting column 'F' for payee works in every other situation but when the row is inflow it sets my own name as payee because i'm the one receiving the money. I would need to set column 'E' for inflows and column 'F' for outflows.

jannesii commented 1 year ago

I coded my own csv converter with python using 'pandas' module and here is how I solved this issue (this is not the full code):

df = DataFrame Saajan nimi = receiver's name Maksaja = payer

def determine_payee(row):
    if row['Outflow'] != 0 and row['Inflow'] == 0:
        return row['Saajan nimi']
    elif row['Inflow'] != 0 and row['Outflow'] == 0:
        return row['Maksaja']
    else:
        return ''

df['Payee'] = df.apply(determine_payee, axis=1)

columns_to_remove = ['Maksaja', 'Saajan nimi']

df.drop(columns=columns_to_remove, inplace=True)

I made the converter to only work with my bank's csv files (S-Bank Finland or S-Pankki), you can take a look at the full code here: https://github.com/jannesi-projects/Excel_and_python.git

I am a beginner student developer, so my code is still pretty messy, but it works :^D

So this issue doesn't exist for me anymore, but i'll leave this open^^

aniav commented 1 year ago

Thank you for the contribution! I hope your tool will be enough for your needs going forward! 😊