pandas: create a caption with to_latex?
As of version 1.0.0, released on 29 January 2020, to_latex accepts caption and label arguments.
I am exporting a table from a pandas script into a .tex and would like to add a caption.
with open('Table1.tex','w') as tf:
    tf.write(df.to_latex(longtable=True))
(I invoke the longtable argument to span the long table over multiple pages.)
The Table1.tex file gets imported into a bigger LaTeX document via the \import command. I would like to add a caption to the table, ideally on its top. Do you think there would be any way for doing that?
I cannot manually edit the Table1.tex, it gets updated regularly using a Python script.