o control whether the â<â,
â>â and â&â characters escaped in the resulting HTML (by default it is
` True  ` ). So to get the HTML without escaped characters pass ` escape=False
`

    
    
    In [362]: df = pd.DataFrame({"a": list("&<>"), "b": np.random.randn(3)})
    

Escaped:

    
    
    In [363]: html = df.to_html()
    
    In [364]: print(html)
    <table border="1" class="dataframe">
      <thead>
        <tr style="text-align: right;">
          <th></th>
          <th>a</th>
          <th>b</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <th>0</th>
          <td>&amp;</td>
          <td>2.396780</td>
        </tr>
        <tr>
          <th>1</th>
          <td>&lt;</td>
          <td>0.014871</td>
        </tr>
        <tr>
          <th>2</th>
          <td>&gt;</td>
          <td>3.357427</td>
        </tr>
      </tbody>
    </table>
    
    In [365]: display(HTML(html))
    <IPython.core.display.HTML object>
    

Not escaped:

    
    
    In [366]: html = df.to_html(escape=False)
    
    In [367]: print(html)
    <table border="1" class="dataframe">
      <thead>
        <tr style="text-align: right;">
          <th></th>
          <th>a</th>
          <th>b</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <th>0</th>
          <td>&</td>
          <td>2.396780</td>
        </tr>
        <tr>
          <th>1</th>
          <td><</td>
          <td>0.014871</td>
        </tr>
        <tr>
          <th>2</th>
          <td>></td>
          <td>3.357427</td>
        </tr>
      </tbody>
    </table>
    
    In [368]: display(HTML(html))
    <IPython.core.display.HTML object>
    

Note

Some browsers may not show a difference in the rendering of the previous two
HTML tables.

###  HTML Table Parsing Gotchas  #

There are some versioning issues surrounding the libraries that are used to
parse HTML tables in the top-level pandas io function ` read_html  ` .

**Issues with** [ **lxml** ](https://lxml.de)

  * Benefits 

>     * [ **lxml** ](https://lxml.de) is very fast.
>
>     * [ **lxml** ](https://lxml.de) requires Cython to install correctly.

  * Drawbacks 

>     * [ **lxml** ](https://lxml.de) does _not_ make any guarantees about the
> results of its parse _unless_ it is given [ **strictly valid markup**
> ](https://validator.w3.org/docs/help.html#validation_basics) .
>
>     * In light of the above, we have chosen to allow you, the user, to use
> the [ **lxml** ](https://lxml.de) backend, but **this backend will use** [
> **html5lib** ](https://github.com/html5lib/html5lib-python) if [ **lxml**
> ](https://lxml.de) fails to parse
>
>     * It is therefore _highly recommended_ that you install both [
> **BeautifulSoup4** ](https://www.crummy.com/software/BeautifulSoup) and [
> **html5lib** ](https://github.com/html5lib/html5lib-python) , so that you
> will still get a valid result (provided everything else is valid) even if [
> **lxml** ](https://lxml.de) fails.

**Issues with** [ **BeautifulSoup4**
](https://www.crummy.com/software/BeautifulSoup) **using** [ **lxml**
](https://lxml.de) **as a backend**

  * The above issues hold here as well since [ **BeautifulSoup4** ](https://www.crummy.com/software/BeautifulSoup) is essentially just a wrapper around a parser backend. 

**Issues with** [ **BeautifulSoup4**
](https://www.crummy.com/software/BeautifulSoup) **using** [ **html5lib**
](https://github.com/html5lib/html5lib-python) **as a backend**

  * Benefits 

>     * [ **html5lib** ](https://github.com/html5lib/html5lib-python) is far
> more lenient than [ **lxml** ](https://lxml.de) and consequently deals with
> _real-life markup_ in a much saner way rather than just, e.g., dropping an
> element without notifying you.
>
>     * [ **html5lib** ](https://github.com/html5lib/html5lib-python)
> _generates valid HTML5 markup from invalid markup automatically_ . This is
> extremely important for parsing HTML tables, since it guarantees a valid
> do