2

I have a big dataframe (more than 100 rows) and I would like to get a scrollbar for the dataframe in the HTML output. Currently before I save it to HTML the scrollbar is there for the dataframe, to scroll down and see the all the rows, but when I save it to HTML the scrollbar disappears and I get a really long table in the html output. I tried to do it by reducing the rows with pd.set_option("display.max_rows", 1) but it doesn't work. Can someone help?

2
  • This doesn't seem to be a question related to pandas. Have you tried the solution in this post? Commented Apr 28, 2020 at 8:26
  • I don't think that this is the case. It has to do with the output in pandas to html. I can't use that code to get a scrollbar in python Commented Apr 29, 2020 at 7:59

1 Answer 1

1

save pandas DataFrame to HTML first:

  html = df.to_html()
  text_file = open("datatable.html", "w")
  text_file.write(html)
  text_file.close()

Then in HTML file:

<iframe src="datatable.html"  height=300px width=800px border=0></iframe>
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.