to_html()

noun

say it: “too AYCH-tee-em-EL” /tu ˌeɪtʃˌtiˌɛmˈɛl/

A pandas method that turns a table into HTML, the code for a web page.

What does to_html() do in pandas?

to_html() is the pandas method that gives back a table as HTML text, ready to put in a web page, such as a weekly report. index=False leaves out the row labels.

by_location = week.groupby("location", as_index=False)["total"].sum()
html = by_location.to_html(index=False)   # "<table ...>" with one row per location

In a sentence

  • “to_html() turned the table into rows the web page could show.”
  • “With index=False, to_html() left the row numbers out.”

Level: Journeyman · More Python terms at this level

Updated