1
pandas
here으로 생성 된 테이블을 PDF로 내보내는 좋은 방법을 발견했습니다.이 파일을 png 파일로 변환하는 부분은 저에게 흥미가 없습니다.pandas 테이블을 pdf로 내보내기
문제는 내가 다음과 같은 오류 메시지가 얻을입니다 : 정말 꽤 하드 오류를 수정하게 처음부터 코드를 이해하고 있지 않다
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-10-9818a71c26bb> in <module>()
13
14 with open(filename, 'wb') as f:
---> 15 f.write(template.format(z.to_latex()))
16
17 subprocess.call(['pdflatex', filename])
TypeError: a bytes-like object is required, not 'str'
합니다. 내 코드는 다음과 같습니다
import subprocess
filename = 'out.tex'
pdffile = 'out.pdf'
template = r'''\documentclass[preview]{{standalone}}
\usepackage{{booktabs}}
\begin{{document}}
{}
\end{{document}}
'''
with open(filename, 'wb') as f:
f.write(template.format(z.to_latex()))
subprocess.call(['pdflatex', filename])
곳 z
가 pandas
으로 생성 된 DataFrame
이다.
누군가가 도와 줄 수 있기를 바랍니다. 미리 감사드립니다. 시토.