Hi Martin,Great work on Beancount!Is there a way to compare balances by month and/or by year. Ie: say I wanted to know how much I spent on each category for each of the last 24 months?
Also, is there a way of converting balances to one currency?
--Thanks,Dvid
You received this message because you are subscribed to the Google Groups "Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beancount+...@googlegroups.com.
To post to this group, send email to bean...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/ec9fc401-cdc4-4cc3-b925-fc0c81419556%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I think the most generic and flexible way to implement that would be via a combination of bean-query generating a table like this:Month Account Balance... ... ...and combining that with a separate tool that would pivot Balance on Month vs. Account, to produce something like this:
Month6/15 7/15 8/15AccountExpenses:Restaurant ... ... ...
Also, is there a way of converting balances to one currency?At which date?I began to prototype a CONVERT() function in bean-query.I think it works, but it needs a bit more work.There are a small number of complications with this that need to be handled for this to work "well":- Which date is used- What to do if a direct conversion isn't available
On Jun 23, 2015, at 10:07 PM, dstep...@gmail.com wrote:Nathan - Would you mind sharing your pandas code? I was actually doing that myself, then I thought I'd ask if someone had already implemented it. It sounds like you are doing exactly what I was planning on implementing. Are you using a hierarchical multi-index?
On Jun 23, 2015, at 10:07 PM, dstep...@gmail.com wrote:Nathan - Would you mind sharing your pandas code? I was actually doing that myself, then I thought I'd ask if someone had already implemented it. It sounds like you are doing exactly what I was planning on implementing. Are you using a hierarchical multi-index?Using bean-query to extract to csv with some post processing, assuming all expenses are same currency:bean-query $filename 'Select date, account, number where account ~ "^Expenses:"’ \| sed 2d | perl -pe 's/^ *| *$//g' | perl -pe 's/ +/,/g' > ledger.csv
Then in Python:>>> import pandas as pd>>> df = pd.read_csv('ledger.csv')>>> df.date = df.date.str.slice(0,7) # Just get the month.>>> grouped = df[df.date > '2015'].groupby(['account', 'date']).sum().number>>> pivot = grouped.unstack().fillna(0) # Moves the last multi-index (date) to columns.>>> pivot.head(1)date 2015-01 2015-02 2015-03 2015-04 2015-05 2015-06accountExpenses:Auto:Gas 94.64 76.95 110 68.4 148.32 38.45The groupby creates a multi-index and unstack() turns it into a pivot table.