applied-econometrics-2024/scripts/sample_report.py

24 lines
706 B
Python

import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
iris = pd.read_csv('https://raw.githubusercontent.com/mwaskom/seaborn-data/master/iris.csv')
# set size of plot
plt.figure(figsize=(5,4))
_ = plt.hist(iris["petal_length"])
# configure PGF
matplotlib.use("pgf")
matplotlib.rcParams.update({
"pgf.texsystem": "pdflatex",
'font.family': 'serif',
'text.usetex': True,
'pgf.rcfonts': False,
})
plt.savefig("../figures/sample.pgf")
summary = iris.describe()
summary.to_latex("../report/sample_table.tex",
columns=["petal_width", "petal_length", "sepal_width", "sepal_length"],
header=["Petal Width", "Petal Length", "Sepal Width", "Sepal Length"])