1
任何人都可以請解釋爲什麼下面的輸出沒有數據?未生產Results.html
。帶CSS樣式的熊貓df.to_html
df = pd.read_csv(os.path.join(root,filename), skip_blank_lines=True)
df.dropna(how="all", inplace=True)
data = df.sort(ascending=True)
HTML('''<style>.white_space_df td { white-space: normal; }</style>''')
HTML(data.to_html(os.path.join(root, "Results.html"), index=False, na_rep="NA", classes='white_space_df'))
更新
我能夠制定出自己的問題,只是包住別人遇到這下面是工作的例子。
df = pd.read_csv(os.path.join(root,filename), skip_blank_lines=True)
df.dropna(how="all", inplace=True)
data = df.sort(ascending=True)
style = '''<style>.white_space_df td { word-wrap: break-word; }</style>'''
style + data.to_html(os.path.join(root, "Results.html"), index=False, na_rep="NA", classes='white_space_df')
你確定你有df中的數據嗎? –
Yip工作正常,如果我刪除'HTML'只有'data.to_html(os.path.join(root,「Results.html」),index = False,na_rep =「NA」)''但當然我試圖添加造型 – iNoob
你正在使用的HTML功能究竟是什麼? –