def df_to_html(caption, df):
    """DataFrame 对象转化为 table"""
    caption = '<caption>{}</caption>'.format(caption)
    html = ['<table border=1 style="font-family:Arial">\n', caption, '<tr>']
    for column in df.columns:
        html.append('<th>' + column + '</th>')
    html.append('</tr>\n')
    for row in df.values:
        tr = ['<tr>']
        for col in row:
            tr.append('<td>' + str(col) + '</td>')
        tr.append('</tr>\n')
        html.append(''.join(tr))
    html.append('</table>\n')
    return ''.join(html)
