Start to play with plotting data from hledger csv export.
parent
367c38592b
commit
26941a5041
|
@ -1,4 +1,5 @@
|
||||||
# Ignore example output file
|
# Ignore example output file
|
||||||
|
report.csv
|
||||||
example/processed
|
example/processed
|
||||||
example/mappings/unmatched.csv
|
example/mappings/unmatched.csv
|
||||||
# ---> Python
|
# ---> Python
|
||||||
|
|
|
@ -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()
|
||||||
|
|
Loading…
Reference in New Issue