8  |  -0.153565  |  -0.460959  |  -0.098108  |  -1.407930  |  -2.487702  |  1.823014  |  0.099873  |  -0.517603  |  -0.509311  |  -1.833175  |  -0.900906  |  0.459493  |  -0.655440  |  1.466122  |  -1.531389  |  -0.422106  |  0.421422  |  0.578615  |  0.259795  |  0.018941  |  -0.168726  |  1.611107  |  -1.586550  |  -1.384941  |  0.858377  |  1.033242  |  1.701343  |  1.748344  |  -0.371182  |  -0.843575  |  2.089641  |  -0.345430  |  -1.740556  |  0.141915  |  -2.197138  |  0.689569  |  -0.150025  |  0.287456  |  0.654016  |  -1.521919  |  -0.918008  |  -0.587528  |  0.230636  |  0.262637  |  0.615674  |  0.600044  |  -0.494699  |  -0.743089  |  0.220026  |  -0.242207  |  0.528216  |  -0.328174  |  -1.536517  |  -1.476640  |  -1.162114  |  -1.260222  |  1.106252  |  -1.467408  |  -0.349341  |  -1.841217  |  0.031296  |  -0.076475  |  -0.353383  |  0.807545  |  0.779064  |  -2.398417  |  -0.267828  |  1.549734  |  0.814397  |  0.284770  |  -0.659369  |  0.761040  |  -0.722067  |  0.810332  |  1.501295  |  1.440865  |  -1.367459  |  -0.700301  |  -1.540662  |  0.159837  |  -0.625415   
  
###  HTML Escaping  #

Suppose you have to display HTML within HTML, that can be a bit of pain when
the renderer canât distinguish. You can use the ` escape  ` formatting
option to handle this, and even use it within a formatter that contains HTML
itself.

    
    
    [67]:
    
    
    
    df4 = pd.DataFrame([['<div></div>', '"&other"', '<span></span>']])
    df4.style
    
    
    
    [67]:
    

|  0  |  1  |  2   
---|---|---|---  
0  |  |  "&other"  |   
      
    
    [68]:
    
    
    
    df4.style.format(escape="html")
    
    
    
    [68]:
    

|  0  |  1  |  2   
---|---|---|---  
0  |  <div></div> |  "&other"  |  <span></span>  
      
    
    [69]:
    
    
    
    df4.style.format('<a href="https://pandas.pydata.org" target="_blank">{}</a>', escape="html")
    
    
    
    [69]:
    

|  0  |  1  |  2   
---|---|---|---  
0  |  [ <div></div> ](https://pandas.pydata.org) |  [ "&other" ](https://pandas.pydata.org) |  [ <span></span> ](https://pandas.pydata.org)  
  
##  Export to Excel  #

Some support ( _since version 0.20.0_ ) is available for exporting styled `
DataFrames  ` Â to Excel worksheets using the ` OpenPyXL  ` or ` XlsxWriter  `
engines. CSS2.2 properties handled include:

  * ` background-color  `

  * ` border-style  ` properties 

  * ` border-width  ` properties 

  * ` border-color  ` properties 

  * ` color  `

  * ` font-family  `

  * ` font-style  `

  * ` font-weight  `

  * ` text-align  `

  * ` text-decoration  `

  * ` vertical-align  `

  * ` white-space:  nowrap  `

  * Shorthand and side-specific border properties are supported (e.g. ` border-style  ` and ` border-left-style  ` ) as well as the ` border  ` shorthands for all sides ( ` border:  1px  solid  green  ` ) or specified sides ( ` border-left:  1px  solid  green  ` ). Using a ` border  ` shorthand will override any border properties set before it (See [ CSS Working Group ](https://drafts.csswg.org/css-backgrounds/#border-shorthands) for more details) 

  * Only CSS2 named colors and hex colors of the form ` #rgb  ` or ` #rrggbb  ` are currently supported. 

  * The following pseudo CSS properties are also available to set Excel specific style properties: 

    * ` number-format  `

    * ` border-style  ` (for Excel-specific styles: âhairâ, âmediumDashDotâ, âdashDotDotâ, âmediumDashDotDotâ, âdashDotâ, âslantDashDotâ, or âmediumDashedâ) 

Table level styles, and data cell CSS-classes are not included in the export
to Excel: individual cells must have their properties mapped by the `
Styler.apply  ` and/or ` Styler.map  ` methods.

    
    
    [70]:
    
    
    
    df2.style.\
        map(style_negative, props='color:red;').\
        highlight_max(axis=0).\
        to_excel('styled.xlsx', engine='openpyxl')
    

A screenshot of the output:

![Excel spreadsheet with styled DataFrame](../_imag