0

I am trying to add multiple Dataframes to a single HTML page with different Headers.

Currently, I am using to_html function to add multiple Dataframes in the HTML page.

Can anyone please help me to add multiple DFs in one page with line breaks and Headers like tags.

Thank You

3
  • What is your code? There is some loop? Commented Apr 24, 2020 at 8:40
  • You mean adding row separators? Commented Apr 24, 2020 at 8:40
  • Here is my code,with open("Res.html", 'w') as _file: _file.write(df1.to_html(border=5) + df2.to_html(index=False,border=5) + df3.to_html(na_rep="",border=5) + +df4.to_html(na_rep="",border=5)) @jezrael Commented Apr 24, 2020 at 8:49

1 Answer 1

1

Maybe it is not a very big problem, But it may help someone

Here is my code:

with open("Result.html", 'w') as _file:
    _file.write('<center>' 
                +'<h1> Main Heading </h1><br><hr>'
                +'<h2> Heading1 </h2>' + df1.to_html(index=False,border=2,justify="center") + '<be><hr>'
                +'<h2> Heading2 </h2>' + df2.to_html(index=False,border=2,justify="center") + '<br><hr>'
                +'<h2> Heading3 </h2>' + df3.to_html(index=False,border=2,justify="center") + '<br><hr>'
                +'</center>')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.