8

DateFrame'tsod'がありますが、これをhtmlに変換します。

tsod.to_html()

これをファイルとして保存するにはどうすればよいですか?'.html'ファイルとして保存することをお勧めします。

4

3 に答える 3

17
with open('my_file.html', 'w') as fo:
    fo.write(tsod.to_html())

または代わりにパンダを使用する

tsod.to_html(open('my_file.html', 'w'))

またはもう一度(@ andy-haydenに感謝)

with open('my_file.html', 'w') as fo:
    tsod.to_html(fo)
于 2013-02-15T15:34:31.873 に答える
3

現在のバージョンのパンダは正常にtsod.to_html('out.html')動作します。

于 2016-04-05T13:48:59.880 に答える
0
a=tsod.to_html()
save(a,'path')

動作します

于 2013-02-15T15:55:00.527 に答える