2024-05-20 08:21:26 发布
网友
我正在尝试删除索引,同时将pandas数据帧转换为html表。原型如下:
import pandas as pd import numpy as np df= pd.DataFrame({'list':np.random.rand(100)}) html_table = df.to_html()
在html表中,我不想显示索引。
似乎需要删除索引名称:
df = df.rename_axis(None)
或:
df.index.name = None
对于不显示索引使用:
print (df.to_string(index=False))
试试这个:
html_table = df.to_html(index = False)
似乎需要删除索引名称:
或:
对于不显示索引使用:
试试这个:
相关问题 更多 >
编程相关推荐