3
®ybìÈ  ã               @   sÀ  d Z ddlmZ ddlmZ ddlZddlmZ ddlm	Z	 ddl
mZmZmZmZmZmZmZmZmZ ddlmZ ddlZdd	lmZ dd
lmZ ddlmZmZmZm Z  ddl!m"Z" ddl#m$Z$ ddl%m&Z& ddl'Z(ddl)m*Z*m+Z+ ddl,j-j.Z/ddl0m1Z1 ddl2m3Z3 ddl4m5Z5m6Z6 e"ddd�Z7yddl8m9Z9 ddl:j;Z<dZ=W n e>k
�rd   dZ=dZ?Y nX eedœdd„ƒZ@G dd„ dƒZAeBdœd d!„ZCd'd"d#„ZDeeeEf eeE ed$œd%d&„ZFdS )(zF
Module for applying conditional formatting to DataFrames and Series.
é    )Údefaultdict)ÚcontextmanagerN)Úpartial)Úproduct)	ÚAnyÚCallableÚDefaultDictÚDictÚListÚOptionalÚSequenceÚTupleÚUnion)Úuuid1)Ú
get_option)Úlib)ÚAxisÚFrameOrSeriesÚFrameOrSeriesUnionÚLabel)Úimport_optional_dependency)Údoc)Úis_float)Úis_dict_likeÚis_list_like)Ú	DataFrame)ÚNDFrame)Ú_maybe_numeric_sliceÚ_non_reducing_sliceÚjinja2z DataFrame.style requires jinja2.)Úextra)ÚcolorsTFz{0} requires matplotlib.)Úfuncc             c   s$   t rttfV  nttj| jƒƒ‚d S )N)Úhas_mplÚpltr!   ÚImportErrorÚno_mpl_messageÚformatÚ__name__)r"   © r)   ú;/tmp/pip-install-4cy230dp/pandas/pandas/io/formats/style.pyÚ_mpl6   s    r+   c               @   s  e Zd ZdZejddƒZejedd�Zej	dƒZ
d~eee eeeeeeeef  f   ee ee ee eee dœd	d
„Zedœdd„Zeejd d�deeee eee  eee ef eeeeee f  eeee eee eeeeeef  ddœdd„ƒZdd„ Zd€ee d dœdd„Zedœdd„Zeddœdd„Zd�ed d!œd"d#„Z d dœd$d%„Z!d dœd&d'„Z"ddœd(d)„Z#d*d+„ Z$d‚e%dƒ ee& d d-œd.d/„Z'd„e%d… ee& d d-œd0d1„Z(d†e%d d2œd3d4„Z)d‡e%d d2œd5d6„Z*dˆe%eee d d7œd8d9„Z+ed d:œd;d<„Z,ed d=œd>d?„Z-eee%eef  dœd@dA„Z.eee%eef  d dBœdCdD„Z/ed dEœdFdG„Z0ed dHœdIdJ„Z1d dœdKdL„Z2ed dœdMdN„Z3d dœdOdP„Z4d dœdQdR„Z5e6eedSœdTdU„ƒZ7d‰eeeeee f  d dWœdXdY„Z8dŠe9e9ee& e9ee9 ee9 d d\œd]d^„Z:e6d‹e9e9e9ee9 ee9 d_œd`da„ƒZ;dŒd dœdbdc„Z<e6d�eee e9ee9 ee9 deœdfdg„ƒZ=dŽee& e9eee9 ee9 d djœdkdl„Z>d�eee& d dnœdodp„Z?d�eee& d dnœdqdr„Z@d‘eee& ed dsœdtdu„ZAe6d’eBeedvœdwdx„ƒZCeDdydz„ ƒZEe%d{œd|d}„ZFdS )“ÚStyleraî	  
    Helps style a DataFrame or Series according to the data with HTML and CSS.

    Parameters
    ----------
    data : Series or DataFrame
        Data to be styled - either a Series or DataFrame.
    precision : int
        Precision to round floats to, defaults to pd.options.display.precision.
    table_styles : list-like, default None
        List of {selector: (attr, value)} dicts; see Notes.
    uuid : str, default None
        A unique identifier to avoid CSS collisions; generated automatically.
    caption : str, default None
        Caption to attach to the table.
    table_attributes : str, default None
        Items that show up in the opening ``<table>`` tag
        in addition to automatic (by default) id.
    cell_ids : bool, default True
        If True, each cell will have an ``id`` attribute in their HTML tag.
        The ``id`` takes the form ``T_<uuid>_row<num_row>_col<num_col>``
        where ``<uuid>`` is the unique identifier, ``<num_row>`` is the row
        number and ``<num_col>`` is the column number.
    na_rep : str, optional
        Representation for missing values.
        If ``na_rep`` is None, no special formatting is applied.

        .. versionadded:: 1.0.0

    Attributes
    ----------
    env : Jinja2 jinja2.Environment
    template : Jinja2 Template
    loader : Jinja2 Loader

    See Also
    --------
    DataFrame.style : Return a Styler object containing methods for building
        a styled HTML representation for the DataFrame.

    Notes
    -----
    Most styling will be done by passing style functions into
    ``Styler.apply`` or ``Styler.applymap``. Style functions should
    return values with strings containing CSS ``'attr: value'`` that will
    be applied to the indicated cells.

    If using in the Jupyter notebook, Styler has defined a ``_repr_html_``
    to automatically render itself. Otherwise call Styler.render to get
    the generated HTML.

    CSS classes are attached to the generated HTML

    * Index and Column names include ``index_name`` and ``level<k>``
      where `k` is its level in a MultiIndex
    * Index label cells include

      * ``row_heading``
      * ``row<n>`` where `n` is the numeric position of the row
      * ``level<k>`` where `k` is the level in a MultiIndex

    * Column label cells include
      * ``col_heading``
      * ``col<n>`` where `n` is the numeric position of the column
      * ``level<k>`` where `k` is the level in a MultiIndex

    * Blank cells include ``blank``
    * Data cells include ``data``
    Úpandaszio/formats/templatesT)ÚloaderZtrim_blockszhtml.tplN)ÚdataÚ	precisionÚtable_stylesÚuuidÚcaptionÚtable_attributesÚcell_idsÚna_repc	       	         sÖ   t tƒˆ_g ˆ_t|tjtjfƒs*tdƒ‚|j	dkr<|j
ƒ }|jj sP|jj rXtdƒ‚|ˆ_|jˆ_|jˆ_|ˆ_|ˆ_|ˆ_|d kr�tdƒ}|ˆ_|ˆ_dˆ_g ˆ_|ˆ_|ˆ_‡fdd„‰ t ‡ fdd	„ƒˆ_d S )
Nz&``data`` must be a Series or DataFrameé   z.style is not supported for non-unique indices.zdisplay.precisionFc                s@   ˆ j d k	rtj| ƒrˆ j S t| ƒr8| dˆ j› d�›}|S | S d S )NÚ.Úf)r6   ÚpdÚisnar   r0   )ÚxZdisplay_format)Úselfr)   r*   Údefault_display_func°   s    z-Styler.__init__.<locals>.default_display_funcc                  s   ˆ S )Nr)   r)   )r>   r)   r*   Ú<lambda>»   s    z!Styler.__init__.<locals>.<lambda>)r   ÚlistÚctxÚ_todoÚ
isinstancer:   ZSeriesr   Ú	TypeErrorÚndimZto_frameÚindexZ	is_uniqueÚcolumnsÚ
ValueErrorr/   r2   r1   r3   r   r0   r4   Úhidden_indexÚhidden_columnsr5   r6   Ú_display_funcs)	r=   r/   r0   r1   r2   r3   r4   r5   r6   r)   )r>   r=   r*   Ú__init__‰   s0    

zStyler.__init__)Úreturnc             C   s   | j ƒ S )zB
        Hooks into Jupyter notebook rich display system.
        )Úrender)r=   r)   r)   r*   Ú_repr_html_½   s    zStyler._repr_html_)ÚklassÚSheet1Ú r   Úinf)Ú
sheet_namer6   Úfloat_formatrG   ÚheaderrF   Úindex_labelÚstartrowÚstartcolÚengineÚmerge_cellsÚencodingÚinf_repÚverboseÚfreeze_panesrM   c             C   s@   ddl m} || ||||||||d�	}|j|||	|
||d� d S )Nr   )ÚExcelFormatter)r6   ÚcolsrV   rU   rF   rW   r[   r]   )rT   rX   rY   r_   rZ   )Zpandas.io.formats.excelr`   Úwrite)r=   Zexcel_writerrT   r6   rU   rG   rV   rF   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r`   Ú	formatterr)   r)   r*   Úto_excelÃ   s$    zStyler.to_excelc       -   
   C   s\  | j pg }| j}| j}| j}| j}| j}| jp>ttƒ ƒj	ddƒ}d}d}	d}
d}d}d}d	d
„ }t
| jƒ}t
| j|ƒ}tƒ }| jjj}| jjj}| jjjƒ }| jjjƒ }|dkr¾dd„ |D ƒ}|dkrÔdd„ |D ƒ}tt|Ž ƒ}ttƒ}g }�xHt|ƒD �]:}d||| dj|gƒdœg|d  }| jjj| }|dk�r>|n|
d|› �g}|dk�rZ|n|}|jd||dj|ƒ| dœƒ |røx¨t|| ƒD ]˜\}}|	d|› �d|› �g}|j|jdi ƒj|i ƒj|g ƒƒ d||dj|ƒt|||ƒdœ}|j||fdƒ}|dk�r|d|dœƒg|d< |j|ƒ �qŽW |j|ƒ qøW | jjj�ròtj| jjjŽ �rò| �ròg } xTt| jjjƒD ]B\}}|
d|› �g}|dk�r–dn|}| jd|dj|ƒdœƒ �qrW | jd|dj|gƒdœgt|d ƒt|ƒ  ƒ |j| ƒ g }!�xút| jjƒD �]è\}}"g }xžt|| ƒD ]Ž\}}|d|› �d|› �g}#dt|||ƒ�oT| ||dj|#dd… ƒdj|#ƒdœ}|j||fdƒ}$|$dk�r¤|d|$dœƒg|d< |j|ƒ �q"W �x,t| jjƒD �]\}}%|d|› �d|› �g}|j|jdi ƒj|i ƒj|g ƒƒ | j||f }&| jj ||f }d|dj|ƒ|&|ƒ||kd œ}'g }(| j!�s\||f|k�r¶dj|dd… ƒ|'d!< xB|||f D ]2})|)j"d"ƒ�r¦|(jt#|)j$d"ƒƒƒ n
|(jd*ƒ �q€W |j|'ƒ |t#|(ƒ jd|› d#|› �ƒ �qÄW |!j|ƒ �qW d$d„ |j%ƒ D ƒ}*| j&}+t'd%ƒ},|,�sD|+�p"d}+d&|+k�r<|+j	d&d'ƒ}+n|+d(7 }+t||*|!|||||+d)�S )+z•
        Convert the DataFrame in `self.data` and the attrs from `_build_styles`
        into a dictionary of {head, body, uuid, cellstyle}.
        ú-Ú_Zrow_headingZcol_headingZ
index_namer/   ZblankrR   c             S   s   | d › d| d › �S )NÚkeyú=Úvaluer)   )Úpairr)   r)   r*   Úformat_attr  s    z&Styler._translate.<locals>.format_attrr7   c             S   s   g | ]
}|g‘qS r)   r)   )Ú.0r<   r)   r)   r*   ú
<listcomp>  s    z%Styler._translate.<locals>.<listcomp>c             S   s   g | ]
}|g‘qS r)   r)   )rl   r<   r)   r)   r*   rm     s    Úthú )Útyperi   Údisplay_valueÚ
is_visibleÚclassNÚlevel)rp   ri   rq   rs   rr   ÚcolZcol_headingsr   Úcolspan)rg   ri   Ú
attributes)rp   ri   rs   Úrow)rp   rr   ri   rq   Úidrs   ÚrowspanÚtd)rp   ri   rs   rq   rr   ry   ú:Z_colc             S   s   g | ]\}}t |ƒ|d œ‘qS ))ÚpropsÚ	selectors)r@   )rl   r}   r~   r)   r)   r*   rm   —  s   zdisplay.html.use_mathjaxzclass="zclass="tex2jax_ignore z class="tex2jax_ignore")ÚheadÚ	cellstyleÚbodyr2   r0   r1   r3   r4   )rR   rR   )(r1   r3   rA   r0   rI   rJ   r2   Ústrr   ÚreplaceÚ_get_level_lengthsrF   rG   Údictr/   ÚnlevelsÚtolistr@   Úzipr   ÚrangeÚjoinÚnamesÚappendÚ	enumerateÚextendÚgetÚ_is_visibleÚcomZany_not_noneÚlenrK   Zilocr5   ÚcountÚtupleÚsplitÚitemsr4   r   )-r=   r1   r3   rA   r0   rI   rJ   r2   ZROW_HEADING_CLASSZCOL_HEADING_CLASSZINDEX_NAME_CLASSZ
DATA_CLASSZBLANK_CLASSZBLANK_VALUErk   Zidx_lengthsZcol_lengthsZcell_contextZn_rlvlsZn_clvlsZrlabelsZclabelsZcellstyle_mapr   ÚrZrow_esÚnameÚcsÚcri   Úesrv   Zindex_header_rowr�   ÚidxZridrz   ru   rc   Zrow_dictr}   r<   r€   Z
table_attrZuse_mathjaxr)   r)   r*   Ú
_translateî   s   







"
$

zStyler._translate)r6   rM   c             C   s,  |dkr"| j jdk	st‚| j jƒ }|dkrJtt| jƒƒ}tt| jjƒƒ}nLt|ƒ}t|ƒdkrj|| jjf}| jj| }| jj	j
|j	ƒ}| jjj
|jƒ}t|ƒrðxˆ|jƒ D ]B\}}t||ƒ}| jjj
|gƒd }	x|D ]}
|| j |
|	f< qÔW q¨W n8t||ƒ}t||fŽ }x |D ]\}}|| j ||f< �qW | S )aÊ  
        Format the text display value of cells.

        Parameters
        ----------
        formatter : str, callable, dict or None
            If ``formatter`` is None, the default formatter is used.
        subset : IndexSlice
            An argument to ``DataFrame.loc`` that restricts which elements
            ``formatter`` is applied to.
        na_rep : str, optional
            Representation for missing values.
            If ``na_rep`` is None, no special formatting is applied.

            .. versionadded:: 1.0.0

        Returns
        -------
        self : Styler

        Notes
        -----
        ``formatter`` is either an ``a`` or a dict ``{column name: a}`` where
        ``a`` is one of

        - str: this will be wrapped in: ``a.format(x)``
        - callable: called with the value of an individual cell

        The default display value for numeric values is the "general" (``g``)
        format with ``pd.options.display.precision`` precision.

        Examples
        --------
        >>> df = pd.DataFrame(np.random.randn(4, 2), columns=['a', 'b'])
        >>> df.style.format("{:.2%}")
        >>> df['c'] = ['a', 'b', 'c', 'd']
        >>> df.style.format({'c': str.upper})
        Nr7   r   )rK   Údefault_factoryÚAssertionErrorr‰   r’   r/   rG   r   ÚlocrF   Úget_indexer_forr   r–   Ú_maybe_wrap_formatterr   )r=   rc   Úsubsetr6   Zrow_locsZcol_locsZsub_dfru   Zcol_formatterZcol_numZrow_numZlocsÚiÚjr)   r)   r*   r'   ¯  s.    '



zStyler.formatc             K   sB   | j ƒ  | jƒ }dd„ |d D ƒ}||d< |j|ƒ | jjf |ŽS )a3  
        Render the built up styles to HTML.

        Parameters
        ----------
        **kwargs
            Any additional keyword arguments are passed
            through to ``self.template.render``.
            This is useful when you need to provide
            additional variables for a custom template.

        Returns
        -------
        rendered : str
            The rendered HTML.

        Notes
        -----
        ``Styler`` objects have defined the ``_repr_html_`` method
        which automatically calls ``self.render()`` when it's the
        last item in a Notebook cell. When calling ``Styler.render()``
        directly, wrap the result in ``IPython.display.HTML`` to view
        the rendered HTML in the notebook.

        Pandas uses the following keys in render. Arguments passed
        in ``**kwargs`` take precedence, so think carefully if you want
        to override them:

        * head
        * cellstyle
        * body
        * uuid
        * precision
        * table_styles
        * caption
        * table_attributes
        c             S   s&   g | ]}t d d„ |d D ƒƒr|‘qS )c             s   s   | ]}t |ƒV  qd S )N)Úany)rl   Úyr)   r)   r*   ú	<genexpr>"  s    z+Styler.render.<locals>.<listcomp>.<genexpr>r}   )r¦   )rl   r<   r)   r)   r*   rm   "  s    z!Styler.render.<locals>.<listcomp>r€   )Ú_computer�   ÚupdateÚtemplaterN   )r=   ÚkwargsÚdZtrimmedr)   r)   r*   rN   ö  s    &
zStyler.render)ÚattrsrM   c             C   s¸   dd„ t | jƒD ƒ}dd„ t | jƒD ƒ}xŠtt|jƒƒD ]x}|j| }|| }x`||g jƒ D ]N\}}|slq^|jdƒ}|s|q^|| }	x&|jdƒD ]}
| j|	|f j	|
ƒ q�W q^W q8W dS )af  
        Update the state of the Styler.

        Collects a mapping of {index_label: ['<property>: <value>']}.

        Parameters
        ----------
        attrs : DataFrame
            should contain strings of '<property>: <value>;<prop2>: <val2>'
            Whitespace shouldn't matter and the final trailing ';' shouldn't
            matter.
        c             S   s   i | ]\}}||“qS r)   r)   )rl   r¤   Úkr)   r)   r*   ú
<dictcomp>4  s    z&Styler._update_ctx.<locals>.<dictcomp>c             S   s   i | ]\}}||“qS r)   r)   )rl   r¤   r¯   r)   r)   r*   r°   5  s    ú;N)
r�   rG   rF   r‰   r’   Z
itertuplesÚrstripr•   rA   rŒ   )r=   r®   ZcoliZrowiZjjZcnr¥   Zrnrš   r¤   rj   r)   r)   r*   Ú_update_ctx'  s    

zStyler._update_ctxF)ÚdeepcopyrM   c             C   sV   t | j| j| j| j| j| jd�}|rBtj| j	ƒ|_	tj| j
ƒ|_
n| j	|_	| j
|_
|S )N)r0   r3   r2   r1   r6   )r,   r/   r0   r3   r2   r1   r6   Úcopyr´   rA   rB   )r=   r´   Zstylerr)   r)   r*   Ú_copyC  s    
zStyler._copyc             C   s   | j dd�S )z'
        Deep copy by default.
        F)r´   )r¶   )r=   r)   r)   r*   Ú__copy__T  s    zStyler.__copy__c             C   s   | j dd�S )NT)r´   )r¶   )r=   Úmemor)   r)   r*   Ú__deepcopy__Z  s    zStyler.__deepcopy__c             C   s   | j jƒ  g | _dS )zb
        Reset the styler, removing any previously applied styles.

        Returns None.
        N)rA   ÚclearrB   )r=   r)   r)   r*   rº   ]  s    
zStyler.clearc             C   s,   | }x"| j D ]\}}}|| ƒ||Ž}qW |S )a  
        Execute the style functions built up in `self._todo`.

        Relies on the conventions that all style functions go through
        .apply or .applymap. The append styles to apply as tuples of

        (application method, *args, **kwargs)
        )rB   )r=   r—   r"   Úargsr¬   r)   r)   r*   r©   f  s    	zStyler._compute.)r"   ÚaxisrM   c       	      K   sø   |d krt d ƒn|}t|ƒ}| jj| }|d k	rR|j|f|ddœ|—Ž}|j|_n\||f|Ž}t|tjƒs~t	dt
|ƒ› d�ƒ‚|jj|jƒo˜|jj|jƒs®tdt
|ƒ› d�ƒ‚|j}| jj| j}||krêtdt
|ƒ› d|j› d|› �ƒ‚| j|ƒ | S )	NÚexpand)r¼   Zresult_typez	Function zE must return a DataFrame when passed to `Styler.apply` with axis=Nonez
Result of z3 must have identical index and columns as the inputz- returned the wrong shape.
Result has shape: z
Expected shape:   )Úslicer   r/   r    ÚapplyrG   rC   r:   r   rD   ÚreprrF   ÚequalsrH   Úshaper³   )	r=   r"   r¼   r£   r¬   r/   ÚresultZresult_shapeZexpected_shaper)   r)   r*   Ú_applyt  s(    

zStyler._applyc             K   s    | j jdd„ |||f|fƒ | S )at  
        Apply a function column-wise, row-wise, or table-wise.

        Updates the HTML representation with the result.

        Parameters
        ----------
        func : function
            ``func`` should take a Series or DataFrame (depending
            on ``axis``), and return an object with the same shape.
            Must return a DataFrame with identical index and
            column labels when ``axis=None``.
        axis : {0 or 'index', 1 or 'columns', None}, default 0
            Apply to each column (``axis=0`` or ``'index'``), to each row
            (``axis=1`` or ``'columns'``), or to the entire DataFrame at once
            with ``axis=None``.
        subset : IndexSlice
            A valid indexer to limit ``data`` to *before* applying the
            function. Consider using a pandas.IndexSlice.
        **kwargs : dict
            Pass along to ``func``.

        Returns
        -------
        self : Styler

        Notes
        -----
        The output shape of ``func`` should match the input, i.e. if
        ``x`` is the input row, column, or table (depending on ``axis``),
        then ``func(x).shape == x.shape`` should be true.

        This is similar to ``DataFrame.apply``, except that ``axis=None``
        applies the function to the entire DataFrame at once,
        rather than column-wise or row-wise.

        Examples
        --------
        >>> def highlight_max(x):
        ...     return ['background-color: yellow' if v == x.max() else ''
                        for v in x]
        ...
        >>> df = pd.DataFrame(np.random.randn(5, 2))
        >>> df.style.apply(highlight_max)
        c             S   s
   t | dƒS )NrÄ   )Úgetattr)Úinstancer)   r)   r*   r?   Ð  s    zStyler.apply.<locals>.<lambda>)rB   rŒ   )r=   r"   r¼   r£   r¬   r)   r)   r*   r¿   ›  s    4zStyler.apply)r"   rM   c             K   sJ   t |f|Ž}|d kr"tjd d … }t|ƒ}| jj| j|ƒ}| j|ƒ | S )N)r   r:   Z
IndexSlicer   r/   r    Úapplymapr³   )r=   r"   r£   r¬   rÃ   r)   r)   r*   Ú	_applymapÔ  s    
zStyler._applymapc             K   s   | j jdd„ ||f|fƒ | S )a/  
        Apply a function elementwise.

        Updates the HTML representation with the result.

        Parameters
        ----------
        func : function
            ``func`` should take a scalar and return a scalar.
        subset : IndexSlice
            A valid indexer to limit ``data`` to *before* applying the
            function. Consider using a pandas.IndexSlice.
        **kwargs : dict
            Pass along to ``func``.

        Returns
        -------
        self : Styler

        See Also
        --------
        Styler.where
        c             S   s
   t | dƒS )NrÈ   )rÅ   )rÆ   r)   r)   r*   r?   ö  s    z!Styler.applymap.<locals>.<lambda>)rB   rŒ   )r=   r"   r£   r¬   r)   r)   r*   rÇ   Ý  s    zStyler.applymap)Úcondri   ÚotherrM   c                s.   ˆdkrd‰| j ‡ ‡‡fdd„fd|i|—ŽS )a  
        Apply a function elementwise.

        Updates the HTML representation with a style which is
        selected in accordance with the return value of a function.

        Parameters
        ----------
        cond : callable
            ``cond`` should take a scalar and return a boolean.
        value : str
            Applied when ``cond`` returns true.
        other : str
            Applied when ``cond`` returns false.
        subset : IndexSlice
            A valid indexer to limit ``data`` to *before* applying the
            function. Consider using a pandas.IndexSlice.
        **kwargs : dict
            Pass along to ``cond``.

        Returns
        -------
        self : Styler

        See Also
        --------
        Styler.applymap
        NrR   c                s   ˆ | ƒrˆS ˆS )Nr)   )Úval)rÉ   rÊ   ri   r)   r*   r?   "  s    zStyler.where.<locals>.<lambda>r£   )rÇ   )r=   rÉ   ri   rÊ   r£   r¬   r)   )rÉ   rÊ   ri   r*   Úwhereú  s    $zStyler.where)r0   rM   c             C   s
   || _ | S )z©
        Set the precision used to render.

        Parameters
        ----------
        precision : int

        Returns
        -------
        self : Styler
        )r0   )r=   r0   r)   r)   r*   Úset_precision%  s    zStyler.set_precision)rw   rM   c             C   s
   || _ | S )aæ  
        Set the table attributes.

        These are the items that show up in the opening ``<table>`` tag
        in addition to to automatic (by default) id.

        Parameters
        ----------
        attributes : str

        Returns
        -------
        self : Styler

        Examples
        --------
        >>> df = pd.DataFrame(np.random.randn(10, 4))
        >>> df.style.set_table_attributes('class="pure-table"')
        # ... <table class="pure-table"> ...
        )r4   )r=   rw   r)   r)   r*   Úset_table_attributes4  s    zStyler.set_table_attributesc             C   s   | j S )zñ
        Export the styles to applied to the current Styler.

        Can be applied to a second style with ``Styler.use``.

        Returns
        -------
        styles : list

        See Also
        --------
        Styler.use
        )rB   )r=   r)   r)   r*   ÚexportL  s    zStyler.export)ÚstylesrM   c             C   s   | j j|ƒ | S )a?  
        Set the styles on the current Styler.

        Possibly uses styles from ``Styler.export``.

        Parameters
        ----------
        styles : list
            List of style functions.

        Returns
        -------
        self : Styler

        See Also
        --------
        Styler.export
        )rB   rŽ   )r=   rÐ   r)   r)   r*   Úuse\  s    z
Styler.use)r2   rM   c             C   s
   || _ | S )z�
        Set the uuid for a Styler.

        Parameters
        ----------
        uuid : str

        Returns
        -------
        self : Styler
        )r2   )r=   r2   r)   r)   r*   Úset_uuidr  s    zStyler.set_uuid)r3   rM   c             C   s
   || _ | S )z¢
        Set the caption on a Styler.

        Parameters
        ----------
        caption : str

        Returns
        -------
        self : Styler
        )r3   )r=   r3   r)   r)   r*   Úset_caption�  s    zStyler.set_captionc             C   s
   || _ | S )aC  
        Set the table styles on a Styler.

        These are placed in a ``<style>`` tag before the generated HTML table.

        Parameters
        ----------
        table_styles : list
            Each individual table_style should be a dictionary with
            ``selector`` and ``props`` keys. ``selector`` should be a CSS
            selector that the style will be applied to (automatically
            prefixed by the table's UUID) and ``props`` should be a list of
            tuples with ``(attribute, value)``.

        Returns
        -------
        self : Styler

        Examples
        --------
        >>> df = pd.DataFrame(np.random.randn(10, 4))
        >>> df.style.set_table_styles(
        ...     [{'selector': 'tr:hover',
        ...       'props': [('background-color', 'yellow')]}]
        ... )
        )r1   )r=   r1   r)   r)   r*   Úset_table_styles�  s    zStyler.set_table_stylesc             C   s
   || _ | S )zÖ
        Set the missing data representation on a Styler.

        .. versionadded:: 1.0.0

        Parameters
        ----------
        na_rep : str

        Returns
        -------
        self : Styler
        )r6   )r=   r6   r)   r)   r*   Ú
set_na_rep®  s    zStyler.set_na_repc             C   s
   d| _ | S )z‹
        Hide any indices from rendering.

        .. versionadded:: 0.23.0

        Returns
        -------
        self : Styler
        T)rI   )r=   r)   r)   r*   Ú
hide_index¿  s    
zStyler.hide_indexc             C   s(   t |ƒ}| jj| }| jj|jƒ| _| S )a-  
        Hide columns from rendering.

        .. versionadded:: 0.23.0

        Parameters
        ----------
        subset : IndexSlice
            An argument to ``DataFrame.loc`` that identifies which columns
            are hidden.

        Returns
        -------
        self : Styler
        )r   r/   r    rG   r¡   rJ   )r=   r£   Z	hidden_dfr)   r)   r*   Úhide_columnsÌ  s    zStyler.hide_columns)Ú
null_colorrM   c             C   s   t j| ƒrd|› �S dS )Nzbackground-color: rR   )r:   r;   )ÚvrØ   r)   r)   r*   Ú_highlight_nullå  s    zStyler._highlight_nullÚred)rØ   r£   rM   c             C   s   | j | j||d� | S )au  
        Shade the background ``null_color`` for missing values.

        Parameters
        ----------
        null_color : str, default 'red'
        subset : label or list of labels, default None
            A valid slice for ``data`` to limit the style application to.

            .. versionadded:: 1.1.0

        Returns
        -------
        self : Styler
        )rØ   r£   )rÇ   rÚ   )r=   rØ   r£   r)   r)   r*   Úhighlight_nullé  s    zStyler.highlight_nullÚPuBuçé&1¬Ú?)ÚlowÚhighr¼   Útext_color_thresholdÚvminÚvmaxrM   c	       	      C   s6   t | j|ƒ}t|ƒ}| j| j||||||||d�	 | S )aÎ  
        Color the background in a gradient style.

        The background color is determined according
        to the data in each column (optionally row). Requires matplotlib.

        Parameters
        ----------
        cmap : str or colormap
            Matplotlib colormap.
        low : float
            Compress the range by the low.
        high : float
            Compress the range by the high.
        axis : {0 or 'index', 1 or 'columns', None}, default 0
            Apply to each column (``axis=0`` or ``'index'``), to each row
            (``axis=1`` or ``'columns'``), or to the entire DataFrame at once
            with ``axis=None``.
        subset : IndexSlice
            A valid slice for ``data`` to limit the style application to.
        text_color_threshold : float or int
            Luminance threshold for determining text color. Facilitates text
            visibility across varying background colors. From 0 to 1.
            0 = all text is dark colored, 1 = all text is light colored.

            .. versionadded:: 0.24.0

        vmin : float, optional
            Minimum data value that corresponds to colormap minimum value.
            When None (default): the minimum value of the data will be used.

            .. versionadded:: 1.0.0

        vmax : float, optional
            Maximum data value that corresponds to colormap maximum value.
            When None (default): the maximum value of the data will be used.

            .. versionadded:: 1.0.0

        Returns
        -------
        self : Styler

        Raises
        ------
        ValueError
            If ``text_color_threshold`` is not a value from 0 to 1.

        Notes
        -----
        Set ``text_color_threshold`` or tune ``low`` and ``high`` to keep the
        text legible by not using the entire range of the color map. The range
        of the data is extended by ``low * (x.max() - x.min())`` and ``high *
        (x.max() - x.min())`` before normalizing.
        )Úcmapr£   r¼   rß   rà   rá   râ   rã   )r   r/   r   r¿   Ú_background_gradient)	r=   rä   rß   rà   r¼   r£   rá   râ   rã   r)   r)   r*   Úbackground_gradient   s    BzStyler.background_gradient)rß   rà   rá   râ   rã   c                s*  t ˆttfƒ s*dˆ  ko"dkn   r6d}t|ƒ‚ttjƒ�à\}‰ |dkr\tj| j	ƒ ƒn|}	|dkrvtj
| j	ƒ ƒn|}
|
|	 }ˆ j|	||  |
||  ƒ}|jj|ƒ|| j	td�ƒƒ}tdœdd„‰tdœ‡ ‡‡fd	d
„‰| jdkrú‡fdd„|D ƒS tj‡fdd„|D ƒ| j| jd�S W dQ R X dS )zD
        Color background in a range according to the data.
        r   r7   z3`text_color_threshold` must be a value from 0 to 1.N)Údtype)rM   c             S   s4   dd„ | dd… D ƒ\}}}d| d|  d|  S )a¶  
                Calculate relative luminance of a color.

                The calculation adheres to the W3C standards
                (https://www.w3.org/WAI/GL/wiki/Relative_luminance)

                Parameters
                ----------
                color : rgb or rgba tuple

                Returns
                -------
                float
                    The relative luminance as a value from 0 to 1
                c             s   s*   | ]"}|d kr|d n
|d d V  qdS )g#Æ‚¤?g×£p=
×)@g)\�Âõ(¬?gáz®Gáð?g333333@Ng6¨£1ò?r)   )rl   r<   r)   r)   r*   r¨   €  s   zJStyler._background_gradient.<locals>.relative_luminance.<locals>.<genexpr>Né   g¼–�z6Ë?g¥,Cëâæ?g]mÅþ²{²?r)   )Úrgbar—   ÚgÚbr)   r)   r*   Úrelative_luminanceo  s    z7Styler._background_gradient.<locals>.relative_luminancec                s0   ˆ| ƒˆk }|rdnd}dˆ j | ƒ› d|› d�S )Nz#f1f1f1z#000000zbackground-color: z;color: r±   )Zrgb2hex)ré   ZdarkZ
text_color)r!   rì   rá   r)   r*   Úcss…  s    z(Styler._background_gradient.<locals>.cssc                s   g | ]}ˆ |ƒ‘qS r)   r)   )rl   ré   )rí   r)   r*   rm   ‹  s    z/Styler._background_gradient.<locals>.<listcomp>c                s   g | ]}‡ fd d„|D ƒ‘qS )c                s   g | ]}ˆ |ƒ‘qS r)   r)   )rl   ré   )rí   r)   r*   rm   Ž  s    z:Styler._background_gradient.<locals>.<listcomp>.<listcomp>r)   )rl   rx   )rí   r)   r*   rm   Ž  s    )rF   rG   )rC   ÚfloatÚintrH   r+   r,   ræ   ÚnpÚnanminÚto_numpyÚnanmaxZ	NormalizeÚcmZget_cmapr‚   rE   r:   r   rF   rG   )Úsrä   rß   rà   rá   râ   rã   Úmsgr$   ÚsminÚsmaxÚrngZnormZrgbasr)   )r!   rí   rì   rá   r*   rå   Q  s$    
zStyler._background_gradientc                s2   dj dd„ |jƒ D ƒƒ‰ ‡ fdd„}| j||d�S )a_  
        Method to set one or more non-data dependent properties or each cell.

        Parameters
        ----------
        subset : IndexSlice
            A valid slice for ``data`` to limit the style application to.
        **kwargs : dict
            A dictionary of property, value pairs to be set for each cell.

        Returns
        -------
        self : Styler

        Examples
        --------
        >>> df = pd.DataFrame(np.random.randn(10, 4))
        >>> df.style.set_properties(color="white", align="right")
        >>> df.style.set_properties(**{'background-color': 'yellow'})
        r±   c             s   s    | ]\}}|› d |› �V  qdS )z: Nr)   )rl   ÚprÙ   r)   r)   r*   r¨   ¨  s    z(Styler.set_properties.<locals>.<genexpr>c                s   ˆ S )Nr)   )r<   )Úvaluesr)   r*   r?   ©  s    z'Styler.set_properties.<locals>.<lambda>)r£   )rŠ   r–   rÇ   )r=   r£   r¬   r9   r)   )rû   r*   Úset_properties“  s    zStyler.set_propertieséd   )Úalignr!   Úwidthrâ   rã   c       	         s  |dkrt j| jƒ ƒn|}|dkr0t j| jƒ ƒn|}ˆ dkrRtd|ƒ}td|ƒ}n ˆ dkrrtt|ƒt|ƒƒ}| }ˆ| jtd�|  || d  }ˆ | || d  ‰ttttdœ‡fdd	„‰‡ ‡‡‡fd
d„‰| j	dkrî‡fdd„|D ƒS t
j‡fdd„|D ƒ| j| jd�S dS )z4
        Draw bar chart in dataframe cells.
        NÚmidr   Úzero)rç   gê-�™—q=)ÚstartÚendÚcolorrM   c                sh   d}|| krd|d7 }| dkr<|d| d›d|› d| d›d�7 }t |ˆ ƒ}||› d|d›d|d›d	�7 }|S )
zL
            Generate CSS code to draw a bar from start to end.
            zwidth: 10em; height: 80%;z"background: linear-gradient(90deg,r   z transparent z.1fz%, ro   z%, transparent z%))Úmin)r  r  r  rí   Úe)rÿ   r)   r*   Úcss_barÆ  s     
zStyler._bar.<locals>.css_barc                sV   t j| ƒrdS | ˆkrˆd nˆd }ˆ dkr:ˆd| |ƒS ˆt| ˆƒt| ˆƒ|ƒS d S )NrR   r7   r   Úleft)r:   r;   r  Úmax)r<   r  )rþ   r!   r  r  r)   r*   rí   Ó  s    
zStyler._bar.<locals>.cssr7   c                s   g | ]}ˆ |ƒ‘qS r)   r)   )rl   r<   )rí   r)   r*   rm   à  s    zStyler._bar.<locals>.<listcomp>c                s   g | ]}‡ fd d„|D ƒ‘qS )c                s   g | ]}ˆ |ƒ‘qS r)   r)   )rl   r<   )rí   r)   r*   rm   ã  s    z*Styler._bar.<locals>.<listcomp>.<listcomp>r)   )rl   rx   )rí   r)   r*   rm   ã  s    )rF   rG   )rð   rñ   rò   ró   r  r	  Úabsrî   r‚   rE   r:   r   rF   rG   )	rõ   rþ   r!   rÿ   râ   rã   r÷   rø   Znormedr)   )rþ   r!   rí   r  rÿ   r  r*   Ú_bar¬  s$    
 
zStyler._barú#d65f5fr  )r¼   rÿ   rþ   râ   rã   rM   c          
   C   sˆ   |d
krt dƒ‚t|ƒs"||g}n2t|ƒdkr@|d |d g}nt|ƒdkrTt dƒ‚t| j|ƒ}t|ƒ}| j| j|||||||d	� | S )a¨  
        Draw bar chart in the cell backgrounds.

        Parameters
        ----------
        subset : IndexSlice, optional
            A valid slice for `data` to limit the style application to.
        axis : {0 or 'index', 1 or 'columns', None}, default 0
            Apply to each column (``axis=0`` or ``'index'``), to each row
            (``axis=1`` or ``'columns'``), or to the entire DataFrame at once
            with ``axis=None``.
        color : str or 2-tuple/list
            If a str is passed, the color is the same for both
            negative and positive numbers. If 2-tuple/list is used, the
            first element is the color_negative and the second is the
            color_positive (eg: ['#d65f5f', '#5fba7d']).
        width : float, default 100
            A number between 0 or 100. The largest value will cover `width`
            percent of the cell's width.
        align : {'left', 'zero',' mid'}, default 'left'
            How to align the bars with the cells.

            - 'left' : the min value starts at the left of the cell.
            - 'zero' : a value of zero is located at the center of the cell.
            - 'mid' : the center of the cell is at (max-min)/2, or
              if values are all negative (positive) the zero is aligned
              at the right (left) of the cell.
        vmin : float, optional
            Minimum bar value, defining the left hand limit
            of the bar drawing range, lower values are clipped to `vmin`.
            When None (default): the minimum value of the data will be used.

            .. versionadded:: 0.24.0

        vmax : float, optional
            Maximum bar value, defining the right hand limit
            of the bar drawing range, higher values are clipped to `vmax`.
            When None (default): the maximum value of the data will be used.

            .. versionadded:: 0.24.0

        Returns
        -------
        self : Styler
        r  r  r   z.`align` must be one of {'left', 'zero',' mid'}r7   r   é   zp`color` must be string or a list-like of length 2: [`color_neg`, `color_pos`] (eg: color=['#d65f5f', '#5fba7d']))r£   r¼   rþ   r!   rÿ   râ   rã   )r  r  r   )rH   r   r’   r   r/   r   r¿   r  )r=   r£   r¼   r  rÿ   rþ   râ   rã   r)   r)   r*   Úbarè  s*    7
z
Styler.barÚyellow)r  r¼   rM   c             C   s   | j |||dd�S )a1  
        Highlight the maximum by shading the background.

        Parameters
        ----------
        subset : IndexSlice, default None
            A valid slice for ``data`` to limit the style application to.
        color : str, default 'yellow'
        axis : {0 or 'index', 1 or 'columns', None}, default 0
            Apply to each column (``axis=0`` or ``'index'``), to each row
            (``axis=1`` or ``'columns'``), or to the entire DataFrame at once
            with ``axis=None``.

        Returns
        -------
        self : Styler
        T)r£   r  r¼   Úmax_)Ú_highlight_handler)r=   r£   r  r¼   r)   r)   r*   Úhighlight_max<  s    zStyler.highlight_maxc             C   s   | j |||dd�S )a1  
        Highlight the minimum by shading the background.

        Parameters
        ----------
        subset : IndexSlice, default None
            A valid slice for ``data`` to limit the style application to.
        color : str, default 'yellow'
        axis : {0 or 'index', 1 or 'columns', None}, default 0
            Apply to each column (``axis=0`` or ``'index'``), to each row
            (``axis=1`` or ``'columns'``), or to the entire DataFrame at once
            with ``axis=None``.

        Returns
        -------
        self : Styler
        F)r£   r  r¼   r  )r  )r=   r£   r  r¼   r)   r)   r*   Úhighlight_minR  s    zStyler.highlight_min)r  r¼   r  rM   c             C   s*   t t| j|ƒƒ}| j| j||||d� | S )N)r  r¼   r£   r  )r   r   r/   r¿   Ú_highlight_extrema)r=   r£   r  r¼   r  r)   r)   r*   r  j  s    zStyler._highlight_handler)r/   r  r  c                sr   d|› �‰ |r"| t j| jƒ ƒk}n| t j| jƒ ƒk}| jdkrP‡ fdd„|D ƒS tjt j|ˆ dƒ| j| j	d�S dS )zD
        Highlight the min or max in a Series or DataFrame.
        zbackground-color: r7   c                s   g | ]}|rˆ nd ‘qS )rR   r)   )rl   rÙ   )Úattrr)   r*   rm   †  s    z-Styler._highlight_extrema.<locals>.<listcomp>rR   )rF   rG   N)
rð   ró   rò   rñ   rE   r:   r   rÌ   rF   rG   )r/   r  r  Zextremar)   )r  r*   r  w  s    

zStyler._highlight_extremac                s0   t jt j|ƒ| jgƒ‰ G ‡ ‡fdd„d| ƒ}|S )aï  
        Factory function for creating a subclass of ``Styler``.

        Uses a custom template and Jinja environment.

        Parameters
        ----------
        searchpath : str or list
            Path or paths of directories containing the templates.
        name : str
            Name of your custom template to use for rendering.

        Returns
        -------
        MyStyler : subclass of Styler
            Has the correct ``env`` and ``template`` class attributes set.
        c                   s"   e Zd Zej” d�Zej”ƒZdS )z-Styler.from_custom_template.<locals>.MyStyler)r.   N)r(   Ú
__module__Ú__qualname__r   ÚEnvironmentÚenvÚget_templater«   r)   )r.   r˜   r)   r*   ÚMyStyler¡  s   r  )r   ZChoiceLoaderZFileSystemLoaderr.   )ÚclsZ
searchpathr˜   r  r)   )r.   r˜   r*   Úfrom_custom_templateŒ  s    zStyler.from_custom_template)r"   c             O   s   t j| |f|ž|ŽS )au	  
        Apply ``func(self, *args, **kwargs)``, and return the result.

        .. versionadded:: 0.24.0

        Parameters
        ----------
        func : function
            Function to apply to the Styler.  Alternatively, a
            ``(callable, keyword)`` tuple where ``keyword`` is a string
            indicating the keyword of ``callable`` that expects the Styler.
        *args : optional
            Arguments passed to `func`.
        **kwargs : optional
            A dictionary of keyword arguments passed into ``func``.

        Returns
        -------
        object :
            The value returned by ``func``.

        See Also
        --------
        DataFrame.pipe : Analogous method for DataFrame.
        Styler.apply : Apply a function row-wise, column-wise, or table-wise to
            modify the dataframe's styling.

        Notes
        -----
        Like :meth:`DataFrame.pipe`, this method can simplify the
        application of several user-defined functions to a styler.  Instead
        of writing:

        .. code-block:: python

            f(g(df.style.set_precision(3), arg1=a), arg2=b, arg3=c)

        users can write:

        .. code-block:: python

            (df.style.set_precision(3)
               .pipe(g, arg1=a)
               .pipe(f, arg2=b, arg3=c))

        In particular, this allows users to define functions that take a
        styler object, along with other parameters, and return the styler after
        making styling changes (such as calling :meth:`Styler.apply` or
        :meth:`Styler.set_properties`).  Using ``.pipe``, these user-defined
        style "transformations" can be interleaved with calls to the built-in
        Styler interface.

        Examples
        --------
        >>> def format_conversion(styler):
        ...     return (styler.set_properties(**{'text-align': 'right'})
        ...                   .format({'conversion': '{:.1%}'}))

        The user-defined ``format_conversion`` function above can be called
        within a sequence of other style modifications:

        >>> df = pd.DataFrame({'trial': list(range(5)),
        ...                    'conversion': [0.75, 0.85, np.nan, 0.7, 0.72]})
        >>> (df.style
        ...    .highlight_min(subset=['conversion'], color='yellow')
        ...    .pipe(format_conversion)
        ...    .set_caption("Results with minimum conversion highlighted."))
        )r‘   Úpipe)r=   r"   r»   r¬   r)   r)   r*   r  §  s    EzStyler.pipe)NNNNNTN)rQ   rR   NNTTNr   r   NTNrS   TN)NN)F)r   N).r,   )r   N).r,   )N)N)NN)rÛ   N)rÝ   r   r   r   NrÞ   NN)rÝ   r   r   rÞ   NN)N)rý   NN)Nr   r  rý   r  NN)Nr  r   )Nr  r   )Nr  NT)r  T)Gr(   r  r  Ú__doc__r   ZPackageLoaderr.   r  r  r  r«   r   r   rï   r
   r	   r‚   r   ÚboolrL   rO   r   r   rd   r   r   r   r�   r'   rN   r   r³   r¶   r·   r¹   rº   r©   r   r   rÄ   r¿   rÈ   rÇ   rÌ   rÍ   rÎ   rÏ   rÑ   rÒ   rÓ   rÔ   rÕ   rÖ   r×   ÚstaticmethodrÚ   rÜ   rî   ræ   rå   rü   r  r  r  r  r  r   r  Úclassmethodr  r  r)   r)   r)   r*   r,   >   sÖ   E
      N+              \ BG1	 $ 3	! $        G     ":  &7      L

   r,   )rM   c             C   s   || f|kS )z/
    Index -> {(idx_row, idx_col): bool}).
    r)   )Zidx_rowZidx_colÚlengthsr)   r)   r*   r�   ï  s    r�   c             C   s"  t | tjƒr| jtjdd�}n| jƒ }|dkr2g }i }| jdkrnx(t|ƒD ]\}}||krJd|d|f< qJW |S xœt|ƒD ]�\}}x†t|ƒD ]z\}}tdƒs¨d|||f< qŠ|tjk	rÌ||krÌ|}	d|||	f< qŠ|tjk	rè|}	d|||	f< qŠ||krŠ|||	f  d7  < qŠW qxW dd„ |j	ƒ D ƒ}
|
S )	zÕ
    Given an index, find the level length for each element.

    Optional argument is a list of index positions which
    should not be visible.

    Result is a dictionary of (level, initial_position): span
    F)ZsparsifyZadjoinNr7   r   zdisplay.multi_sparsec             S   s   i | ]\}}|d kr||“qS )r7   r)   )rl   ÚelementÚlengthr)   r)   r*   r°     s   z&_get_level_lengths.<locals>.<dictcomp>)
rC   r:   Z
MultiIndexr'   r   Z
no_defaultr†   r�   r   r–   )rF   Zhidden_elementsZlevelsr#  r¤   ri   Zlvlr¥   rx   Z
last_labelZnon_zero_lengthsr)   r)   r*   r„   ö  s4    	

r„   )rc   r6   rM   c                sv   t ˆ tƒr‡ fdd„‰n"tˆ ƒr&ˆ ‰ndˆ › d�}t|ƒ‚ˆd krFˆS t ˆtƒr^‡‡fdd„S dˆ› d�}t|ƒ‚d S )Nc                s
   ˆ j | ƒS )N)r'   )r<   )rc   r)   r*   r?   (  s    z'_maybe_wrap_formatter.<locals>.<lambda>z,Expected a template string or callable, got z insteadc                s   t j| ƒrˆS ˆ | ƒS )N)r:   r;   )r<   )Úformatter_funcr6   r)   r*   r?   2  s    zExpected a string, got )rC   r‚   ÚcallablerD   )rc   r6   rö   r)   )rc   r&  r6   r*   r¢   $  s    

r¢   )N)Gr  Úcollectionsr   Ú
contextlibr   rµ   Ú	functoolsr   Ú	itertoolsr   Útypingr   r   r   r	   r
   r   r   r   r   r2   r   Znumpyrð   Zpandas._configr   Zpandas._libsr   Zpandas._typingr   r   r   r   Zpandas.compat._optionalr   Zpandas.util._decoratorsr   Zpandas.core.dtypes.commonr   r-   r:   Zpandas.api.typesr   r   Zpandas.core.commonÚcoreÚcommonr‘   Zpandas.core.framer   Zpandas.core.genericr   Zpandas.core.indexingr   r   r   Z
matplotlibr!   Zmatplotlib.pyplotZpyplotr$   r#   r%   r&   r+   r,   r   r�   r„   r‚   r¢   r)   r)   r)   r*   Ú<module>   s\   ,

           <
/