我刚刚开始学习Flask和Python。上传csv文件时出现问题,我想引导数据显示在网页上的文件中(由html生成)
现在mywebpage显示
Timestamp ... 561อกข้อที่ถูกที่สุด0 2561/12/25 2:30:50หลังเที่ยงGMT + 7 ... NaN 1 2561/12/25 2:31:40หลังเที่ยงGMT + 7 .. NaN 2 2561/12/25 2:32:01งGMT + 7 ... NaN 3 2561/12/25 2:32:15งGMT + 7 ... NaN 4 2561/12/25 2: 33:18格林尼治标准时间+7 ... NaN 5 2561/12/25 2:39:02格林尼治标准时间+7 ... 1 6 2561/12/25 2:40:19格林尼治标准时间+7 ... NaN 7 NaN ... NaN 8 NaN ... NaN 9,ขอโทษค่ะ,ตามนั้ค่ะ... NaN 10 NaN ... NaN 11 NaN ... NaN 12 NaN ... NaN [13行x 16列]
但是我想要 enter image description here
谢谢您的帮助。
答案 0 :(得分:0)
例如
>> print(yourdataframe.to_html())
请记住,Python和HTML是不同的结构。您必须正确设置HTML表。
输出如下:
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>foo1</th>
<th>foo2</th>
<th>foo3</th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>-0.623329</td>
<td>0.086472</td>
<td>0.506933</td>
</tr>
<tr>
<th>1</th>
<td>0.988126</td>
<td>0.172142</td>
<td>0.903697</td>
</tr>
</tbody>
</table>