Eine Python -Tabelle in einer HTML -Datei neu formatieren

import numpy as np
from numpy.random import randn
import pandas as pd
import matplotlib.pyplot as plt
df = pd.DataFrame(randn(5,4),columns='W X Y Z'.split())
df1 = pd.DataFrame(randn(5,4),columns='A B C D'.split())
df2 = pd.DataFrame(randn(5,4),columns='E F G K'.split())

html = """
    {table1}
    <table>
      <tr>
        <td>{table2}</td>
        <td>{table3}</td>
      </tr>
    </table>
    """.format(
        table1=df.head().to_html(),
        table2=df1.head().to_html(),
        table3=df2.head().to_html()
    )
with open("a.html", 'w') as _file:
    _file.write(html)
Angry Aardvark