.to_html() also can be used to create html string
import io
import pandas as pd
from numpy.random import randn
df = pd.DataFrame(
    randn(5, 4),
    index = 'A B C D E'.split(),
    columns = 'W X Y Z'.split()
)
str_io = io.StringIO()
df.to_html(buf=str_io, classes='table table-striped')
html_str = str_io.getvalue()
htmlFile = open("QueryFunnelView.html", "w")
htmlFile.write(htmlStr)    
htmlFile.close()
files.download("QueryFunnelView.html")
from : https://stackoverflow.com/questions/32430009/python-pandas-data-frame-save-as-html-page/32430049
 
No comments:
Post a Comment