Replicating Jupyter Notebook Pandas dataframe HTML printout

前端 未结 2 635
野性不改
野性不改 2021-01-05 10:13

I\'m trying to replicate the output that jupyter uses for a pandas dataframe in their notebooks to html/css/js so that it\'s returnable by Flask jsonify as html

2条回答
  •  别那么骄傲
    2021-01-05 10:38

    Definitely took me a while to look for where the template is, but here it is, link.

    I believe this includes all the CSS for notebook cell outputs, so you just need the table related parts (table, thead, tbody, th, etc) and tweak them to your liking. You still need to turn it in python, but to illustrate it works, here's the raw HTML

    0
    first second
    bar one -0.466253
    two -0.579658
    baz one 1.868159
    two 0.392282
    foo one -2.427858
    two -0.813941
    qux one 0.110564
    two 0.834701

提交回复
热议问题