Hi Red,

Thanks!! That also solves it, better - no exporting to ledger.

This is a nice tool, combined with Emacs & Org Mode:

#+NAME: cc_payments
#+begin_src bash :exports both :results table
bean-query -f csv bc.bean "SELECT date, position, payee WHERE account ~ 
'Checking' AND STR(FINDFIRST('Liabilities:CC:*', other_accounts)) != 'None'" | 
sed s/USD//g
#+end_src

Puts out at table

#+RESULTS: cc_payments
|       date | position | payee |
| 2024-01-17 |    -22   | Visa  |
| 2024-01-18 | -44.56   | MC    |
| 2024-01-29 | -12.33   | Visa  |
| 2024-02-20 |  -9.55   | MC    |

And then below I can plot it and summarize it:

#+BEGIN_SRC jupyter-python :exports both :var tbl=cc_payments
import pandas as pd
df = pd.DataFrame(index = pd.to_datetime([_[0] for _ in tbl[1:]]),
                  data = [_[1] for _ in tbl[1:]],
                  columns = ['amt'])
df = df.resample('MS').sum()
print("Average: ", df.mean().values.round(2))
(-1*df).plot(drawstyle='steps-pre')
df
#+END_SRC

Table of monthly amounts
Graphic

  -k.

-- 
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/beancount/87h5zsoqhv.fsf%40gmail.com.

Reply via email to