Start to play with plotting data from hledger csv export.

master
Felix Martin 2020-09-02 22:24:40 -04:00
parent 367c38592b
commit 26941a5041
2 changed files with 33 additions and 0 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
# Ignore example output file
report.csv
example/processed
example/mappings/unmatched.csv
# ---> Python

32
report.py Normal file
View File

@ -0,0 +1,32 @@
import subprocess
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
def configure_plot():
plt.figure()
axes = plt.gca()
axes.set_xlim([0, 300])
axes.set_ylim([-256, 100])
plt.xlabel("#bets []")
plt.ylabel("win [$]")
def report():
df = pd.read_csv("report.csv",
index_col='Account',
parse_dates=True)
df = df.drop(columns="Total:")
#print(df)
# print(df.info())
df.plot.bar()
plt.savefig('figure_1.png')
# plt.show()
if __name__ == "__main__":
c = "hledger balance -M -V -b 2020 --depth 2 ^expenses: --transpose -o report.csv".split()
subprocess.call(c)
c = r"sed -i s/\$//g report.csv".split()
subprocess.call(c)
report()