displaying Pandas DataFrame in HTML without the extra row

后端 未结 2 1997
后悔当初
后悔当初 2021-01-13 21:13

If I use DataFrame.set_index, I get this result:

import pandas as pd

df = pd.DataFrame([[\'foo\',1,3.0],[\'bar\',2,2.9],
                   [\'         


        
2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-13 21:40

    These days pandas actually has a keyword for this:

    df.to_html(index_names=False)
    

    https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_html.html

提交回复
热议问题