def to_latex(df, fn):
    """
    write a dataframe as a latex table to a file. 
    """
    with open(fn, 'w') as tf:
        tf.write(
            '\\documentclass{article}\t\t\t\t\\usepackage{booktabs}\t\t\t\t\\begin{document}'
            )
        tf.write(df.to_latex())
        tf.write('\\end{document}')
