1import pandas as pd
2df = pd.DataFrame({"a":range(10), "b":range(10,20)})
3with open("my_table.tex", "w") as f:
4 f.write("\\begin{tabular}{" + " | ".join(["c"] * len(df.columns)) + "}\n")
5 for i, row in df.iterrows():
6 f.write(" & ".join([str(x) for x in row.values]) + " \\\\\n")
7 f.write("\\end{tabular}")