JS dataTables from pandas

前端 未结 4 1845
挽巷
挽巷 2020-12-15 23:14

I want to use pandas dataFrames with dataTables. I cannot figure out how to initialize the table without an id.

Is there any way to set the id in the table tag w

4条回答
  •  不知归路
    2020-12-16 00:08

    Although the accepted answer works amazingly, here is what i did to apply id and also some classes to heading of tables.

    html = df.to_html().replace('

    This works because to_html just returns a string and we can use python replace method of string objects to replace any part with anything else( note that i used only the opening '<'). I used this to include styles to ie. headings section of the table!

提交回复
热议问题