Using this accepted answer as a reference, I've been trying to replicate the pandas DF to TeX to PDF to png recipe. However, my Python 3 (using a Jupyter Notebook thru Anaconda Navigator) is giving me some trouble.
I've installed MiKTeX at the following default location on my local disk:
C:\Users\USERNAME\AppData\Local\Programs\MiKTeX\2.9
I also installed LaTex at the following location:
C:\Users\USERNAME\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\notebook\static\components\MathJax\extensions\TeX
However, when I run the chunk of code using my Pandas df object:
filename = 'out.tex'
pdffile = 'out.pdf'
outname = 'out.png'
template = r'''\documentclass[preview]{{standalone}}
\usepackage{{booktabs}}
\begin{{document}}
{}
\end{{document}}
'''
with open(filename, 'wb') as f:
f.write(bytes(template.format(df.to_latex()),'UTF-8'))
subprocess.call(['pdflatex', filename], shell=True)
subprocess.call(['convert', '-density', '300', pdffile, '-quality', '90', outname])
It's simply returning "4", and the only file created from my original df is "out.tex". I'd like the DF to be turned into a png image so I can keep the full process in my Notebook script.
Any advice would be much appreciated. Thanks.