Remove border from html table created via pandas

If you are would like use pd.Styler. You could do something like this :

ricSubscription.style.set_table_attributes(
    'style="border-collapse:collapse"'
).set_table_styles([
    # Rest of styles
]).render()

to_html() generates <table border="1" class="dataframe">...

You could just do:

ricSubscription.to_html().replace('border="1"','border="0"')

Also, to answer specifically, there does not appear to be anything you can pass. border="1" appears to be hardcoded:

https://github.com/pydata/pandas/blob/e4cb0f8a6cbb5f0c89b24783baa44326e4b2cccb/pandas/core/format.py#L893


As of version 0.19.0, pandas to_html() borders can be changed in two ways:

  1. Globally: pd.options.html.border = 0
  2. Locally: to_html(border = 0)


UPDATE 2019-07-11:

Per @Hagbard's comment, my original global solution has been deprecated in favor of the following: pd.options.display.html.border = 0


Docs: https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.to_html.html