I am trying to plot a dataframe as a table and save it to pdf. I am able to save figures to pdf using this example https://matplotlib.org/examples/pylab_examples/multipage_pdf.html. I can also plot the table I want but not save it to pdf. :
I an trying with
fig_stats = plt.figure(figsize=(12, 9))
fig_stats = ff.create_table(df_stats)
plt.title('Derived features')
#txt = 'this is an example'
plt.text(0.05, 0.95, txt, transform=fig_stats.transFigure, size=24)
pdf.savefig()
plt.close()
but I am not allowed to save this to a pdf, I get AttributeError: 'Figure' object has no attribute 'transFigure'
I also tried with Matplotlibs own table generator, but neither works. I would really appreciate being able to use the PdfPages package as I also need to plot some figures in the same pdf. Any ideas as to what I am doing wrong ? Thanks in advance