Pandas create empty DataFrame with only column names

后端 未结 4 1771
情歌与酒
情歌与酒 2021-01-29 18:38

I have a dynamic DataFrame which works fine, but when there are no data to be added into the DataFrame I get an error. And therefore I need a solution to create an empty DataFra

4条回答
  •  一生所求
    2021-01-29 19:18

    df.to_html() has a columns parameter.

    Just pass the columns into the to_html() method.

    df.to_html(columns=['A','B','C','D','E','F','G'])
    

提交回复
热议问题