import pandas as pd
a = 'string1'
b = 'string2'
test_dict = {'col1':{a:type(a), b:type(b)},'col2':{a:type(a), b:type(b)}}
df = pd.DataFrame(test_dict)
html = df._repr_html_()
print html
df
<div style="max-height:1000px;max-width:1500px;overflow:auto;"> <table border="1" class="dataframe"> <thead> <tr style="text-align: right;"> <th></th> <th>col1</th> <th>col2</th> </tr> </thead> <tbody> <tr> <td><strong>string1</strong></td> <td> <type 'str'></td> <td> <type 'str'></td> </tr> <tr> <td><strong>string2</strong></td> <td> <type 'str'></td> <td> <type 'str'></td> </tr> </tbody> </table> </div>
col1 | col2 | |
---|---|---|
string1 | |
|
string2 | |
|