Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/site-packages/pandas/io/formats/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/site-packages/pandas/io/formats/__pycache__/format.cpython-312.pyc

�

MٜgO���UdZddlmZddlmZmZmZmZddlm	Z	ddl
mZddlm
Z
ddlmZddlmZdd	lZdd	lZdd
lmZddlmZmZmZmZmZdd	lZddlmZm Z dd
l!m"Z"ddl#m$Z$ddl%m&Z&m'Z'm(Z(ddl)m*Z*ddl+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1ddl2m3Z3m4Z4m5Z5ddl6m7Z7m8Z8ddl9m:Z:m;Z;m<Z<m=Z=ddl>m?Z?ddl@mAZAdd	lBmCcmDZEddlFmGZGmHZHmIZImJZJddlKmLZLddlMmNZNddlOmPZPddlQmRZRmSZSddlTmUZUer$ddlVmWZWmXZXmYZYmZZZm[Z[m\Z\m]Z]m^Z^m_Z_m`Z`maZambZbddlcmdZdmeZedZfd egd!<d"Zhd#Zid egd$<Gd%�d&�ZjdNd'�ZkdNd(�ZlGd)�d*�ZmGd+�d,�Zn		dO							dPd-�Zoe		dQ					dRd.��Zp									dS																							dTd/�ZqGd0�d1�ZrGd2�d3er�ZsGd4�d5er�ZtGd6�d7er�ZuGd8�d9er�Zv				dUd:�ZwdVd;�ZxdWdXd<�Zy		dY							dZd=�Zz	dY							d[d>�Z{Gd?�d@eu�Z|GdA�dBer�Z}		d\							d]dC�Z~			d^									d_dD�Zd`dadE�Z�dbdF�Z�	d`					dcdG�Z�dddH�Z�GdI�dJ�Z�dedfdK�Z�	dg					dhdL�Z�didM�Z�y	)jz�
Internal module for formatting output data in csv, html, xml,
and latex files. This module also applies to display formatting.
�)�annotations)�	Generator�Hashable�Mapping�Sequence)�contextmanager)�
QUOTE_NONE)�Decimal)�partial)�StringION)�get_terminal_size)�
TYPE_CHECKING�Any�Callable�Final�cast)�
get_option�
set_option)�lib)�NA)�NaT�	Timedelta�	Timestamp)�NaTType)�is_complex_dtype�is_float�
is_integer�is_list_like�is_numeric_dtype�	is_scalar)�CategoricalDtype�DatetimeTZDtype�ExtensionDtype)�isna�notna)�Categorical�
DatetimeArray�ExtensionArray�TimedeltaArray)�StringDtype)�PandasObject)�Index�
MultiIndex�PeriodIndex�ensure_index)�
DatetimeIndex)�TimedeltaIndex)�concat)�check_parent_directory�stringify_path)�printing)�	ArrayLike�Axes�ColspaceArgType�ColspaceType�CompressionOptions�FilePath�FloatFormatType�FormattersType�
IndexLabel�SequenceNotStr�StorageOptions�WriteBuffer)�	DataFrame�Seriesa�	
        Parameters
        ----------
        buf : str, Path or StringIO-like, optional, default None
            Buffer to write to. If None, the output is returned as a string.
        columns : array-like, optional, default None
            The subset of columns to write. Writes all columns by default.
        col_space : %(col_space_type)s, optional
            %(col_space)s.
        header : %(header_type)s, optional
            %(header)s.
        index : bool, optional, default True
            Whether to print index (row) labels.
        na_rep : str, optional, default 'NaN'
            String representation of ``NaN`` to use.
        formatters : list, tuple or dict of one-param. functions, optional
            Formatter functions to apply to columns' elements by position or
            name.
            The result of each function must be a unicode string.
            List/tuple must be of length equal to the number of columns.
        float_format : one-parameter function, optional, default None
            Formatter function to apply to columns' elements if they are
            floats. This function must return a unicode string and will be
            applied only to the non-``NaN`` elements, with ``NaN`` being
            handled by ``na_rep``.
        sparsify : bool, optional, default True
            Set to False for a DataFrame with a hierarchical index to print
            every multiindex key at each row.
        index_names : bool, optional, default True
            Prints the names of the indexes.
        justify : str, default None
            How to justify the column labels. If None uses the option from
            the print configuration (controlled by set_option), 'right' out
            of the box. Valid values are

            * left
            * right
            * center
            * justify
            * justify-all
            * start
            * end
            * inherit
            * match-parent
            * initial
            * unset.
        max_rows : int, optional
            Maximum number of rows to display in the console.
        max_cols : int, optional
            Maximum number of columns to display in the console.
        show_dimensions : bool, default False
            Display DataFrame dimensions (number of rows by number of columns).
        decimal : str, default '.'
            Character recognized as decimal separator, e.g. ',' in Europe.
    r�common_docstring)�left�right�center�justifyzjustify-all�start�end�inheritzmatch-parent�initial�unsetz�
        Returns
        -------
        str or None
            If buf is None, returns the result as a string. Otherwise returns
            None.
    �return_docstringc
�x�eZdZdZdddddddddd�																						dd�Zd
d�Zdd	�Zdd
�Zdd�Zy)�SeriesFormatterz\
    Implement the main logic of Series.to_string, which underlies
    Series.__repr__.
    T�NaNFN)	�length�header�index�na_rep�name�float_format�dtype�max_rows�min_rowsc	��||_t�|_||_||_||_||_||_|	|_|
|_	|�td�}||_||_tj�|_|j!�y)N�display.float_format)�seriesr�bufrVrUrSrRrTrYrZrrWrXr5�get_adjustment�adj�
_chk_truncate)�selfr]rRrSrTrUrVrWrXrYrZs           �C/usr/local/lib/python3.12/site-packages/pandas/io/formats/format.py�__init__zSeriesFormatter.__init__�s�������:�����	������������
� ��
� ��
���%�&<�=�L�(�����
��*�*�,�������c��||j}|j}|xrt|j�|kD}|j}|rjt	t
|�}|rt
||�}|dk(r|}|jd|}n-|dz}t|jd||j|df�}||_	nd|_	||_
||_y)N��)rZrY�lenr]r�int�min�ilocr2�
tr_row_num�	tr_series�is_truncated_vertically)rbrZrYror]�row_nums      rcrazSeriesFormatter._chk_truncate�s�����=�=���=�=��#+�"L��D�K�K�0@�8�0K������"��C��*�H���x��2���1�}�"�����Y�h�/��"�a�-������X�g�!6����W�H�I�8N� O�P��%�D�O�"�D�O����'>��$rec�N�|jj}d}|jj}t|tt
tf�r|j�|d|j��z
}|jdur(|�&|r|dz
}tj|d��}|d|��z
}|jdus|jd	k(r.|jr"|r|dz
}|d
t|j���z
}|jdurQ|j�Et|j jdd�}|r"|r|dz
}|dtj|���z
}t|j jt"�r0|j j$j'�}|r|d
z
}||z
}t)|�S)N�zFreq: Fz, ��	�
�
)�escape_charszName: T�truncatezLength: rVzdtype: rv)r]rVrT�
isinstancer0r.r1�freq�freqstrr5�pprint_thingrRrorirX�getattrrnr!�_values�_get_repr_footer�str)rbrV�footerrT�series_name�
dtype_name�
level_infos       rc�_get_footerzSeriesFormatter._get_footer�s����{�{���������!�!���u�}�k�>�J�K��
�
�&���u�}�}�o�.�.�F��9�9�E�!�d�&6���$���"�/�/��CU�V�K���{�m�,�,�F��;�;�$���K�K�:�%�$�*F�*F���$������T�[�[�!1� 2�3�3�F��:�:�U�"�t�z�z�'=� ����!5�!5�v�t�D�J����d�N�F��G�H�$9�$9�*�$E�#F�G�G���d�n�n�*�*�,<�=����/�/�@�@�B�J���$����j� �F��6�{�rec��t|jjd|j|j|j
��S)N)rWrU�
leading_space)�format_arrayrnr~rWrUrT�rbs rc�_get_formatted_valuesz%SeriesFormatter._get_formatted_values(s6����N�N�"�"���*�*��;�;��*�*�
�	
rec��|j}|j�}t|�dk(r%t|j�j
�d|�d�S|j}t|�}t|t�rJ|jdd��}tj�}|jdg|���jd�}n|jd��}|j!�}|j"r�d}|j$}	t't(|	�}	|j*j||	d	z
�}
|
d
kDrd}nd}|j*j-|g|
d
��d}|j/|	|z|�|j/|	d	zd�|jr#|j*jd
g|d	d|g���}n|j*jd
|�}|j0r
|r|ddz|z}|r|d|zz
}t3dj5|��S)Nrz([], �)T)�
include_names�sparsifyrhrv��include_namerg��...z..rG��moderr)rnr�ri�typer]�__name__rT�
_has_namesryr-�
_format_multir5r_�adjoin�split�_format_flatr�rormrrjr`rH�insertrSr��join)
rbr]r�rT�have_header�	fmt_indexr`�
fmt_values�
n_header_rowsrp�width�dot_str�results
             rc�	to_stringzSeriesFormatter.to_string1s��������!�!�#���v�;�!���4�;�;�'�0�0�1��v�h�a�@�@����� ��'���e�Z�(��+�+�$��+�N�I��)�)�+�C�"��
�
�1�1�y�1�7�7��=�I��*�*��*�=�I��/�/�1�
��'�'��M��o�o�G��3��(�G��H�H�L�L��G�a�K�!8�9�E��q�y������h�h�&�&��y�%�h�&�G��J�G����g�
�5�w�?����W�q�[�"�-��:�:�$�T�X�X�_�_�Q�E�)�A�B�-��)D�E�F��X�X�_�_�Q�
�3�F��;�;�;��q�\�D�(�6�1�F���d�V�m�#�F��2�7�7�6�?�#�#re)r]rCrR�
bool | strrS�boolrTr�rUr�rVr�rW�
str | NonerXr�rY�
int | NonerZr��return�None�r�r��r�r��r��	list[str])	r��
__module__�__qualname__�__doc__rdrar�r�r��rercrPrP�s����"�����#'��#�#�����	�
���
�����!��������
��@?�6(�T
�+$rerPc��ddlm}td�r|j�\}}nd}td�td�td�td�td	�|d
�S)a�Get the parameters used to repr(dataFrame) calls using DataFrame.to_string.

    Supplying these parameters to DataFrame.to_string is equivalent to calling
    ``repr(DataFrame)``. This is useful if you want to adjust the repr output.

    .. versionadded:: 1.4.0

    Example
    -------
    >>> import pandas as pd
    >>>
    >>> df = pd.DataFrame([[1, 2], [3, 4]])
    >>> repr_params = pd.io.formats.format.get_dataframe_repr_params()
    >>> repr(df) == df.to_string(**repr_params)
    True
    r)�consolezdisplay.expand_frame_reprN�display.max_rows�display.min_rowszdisplay.max_columns�display.max_colwidth�display.show_dimensions)rYrZ�max_cols�max_colwidth�show_dimensions�
line_width)�pandas.io.formatsr�r�get_console_size)r�r��_s   rc�get_dataframe_repr_paramsr�_sa��"*��-�.��0�0�2�
�
�A��
��1�2��1�2��4�5�"�#9�:�%�&?�@� �
�rec��t�\}}td�}|dk(r|n|}|dk(r|n
td�}dd||td�d�S)a�Get the parameters used to repr(Series) calls using Series.to_string.

    Supplying these parameters to Series.to_string is equivalent to calling
    ``repr(series)``. This is useful if you want to adjust the series repr output.

    .. versionadded:: 1.4.0

    Example
    -------
    >>> import pandas as pd
    >>>
    >>> ser = pd.Series([1, 2, 3, 4])
    >>> repr_params = pd.io.formats.format.get_series_repr_params()
    >>> repr(ser) == ser.to_string(**repr_params)
    True
    r�rr�Tr�)rVrXrZrYrR)r
r)r��height�max_rows_optrYrZs     rc�get_series_repr_paramsr��s^��"&�'�M�E�6��0�1�L�%��*�v��H�%��*�v�
�;M�0N�H������6�7��rec��eZdZdZerendZeeezz
Z																	d%																																					d&d�Zd'd�Zed(d��Z	ed(d��Z
ed(d��Zed(d	��Zed)d
��Z
ed(d��Zed(d��Zed(d
��Zed(d��Zed*d��Zd+d�Z				d,d�Zd-d�Zd.d�Zd/d�Zd0d�Zd0d�Zd1d�Zd(d�Zd(d�Zd(d�Zd*d�Zd2d�Zd2d�Z d2d�Z!d'd�Z"d3d �Z#d4d!�Z$d5d"�Z%d6d#�Z&d7d$�Z'y)8�DataFrameFormatterz�
    Class for processing dataframe formatting options and data.

    Used by DataFrame.to_string, which backs DataFrame.__repr__.
    rrNc�^�||_|j|�|_|j|�|_||_||_||_|j|�|_	|j|�|_|	|_|j|
�|_||_||_||_||_||_|
|_||_||_|j/�|_|j3�|_|j|_|j9�t;j<�|_y�N) �frame�_initialize_columns�columns�_initialize_colspace�	col_spacerSrTrU�_initialize_formatters�
formatters�_initialize_justifyrHrW�_initialize_sparsifyr��show_index_names�decimal�	bold_rows�escaperYrZr�r��_calc_max_cols_fitted�max_cols_fitted�_calc_max_rows_fitted�max_rows_fitted�tr_framerxr5r_r`)rbr�r�r�rSrTrUr�rHrWr��index_namesrYrZr�r�r�r�r�s                   rcrdzDataFrameFormatter.__init__�s��*��
��/�/��8����2�2�9�=��������
�����5�5�j�A����/�/��8���(����1�1�(�;��
� +������"������ ��
� ��
� ��
�.���#�9�9�;���#�9�9�;����
�
��
��
�
���*�*�,��rec��|j�}|jr-|j|j�}|j	d|�|S)zP
        Render a DataFrame to a list of columns (as lists of strings).
        r)�_get_strcols_without_indexrT�_get_formatted_indexr�r�)rb�strcols�	str_indexs   rc�get_strcolszDataFrameFormatter.get_strcols�s@���1�1�3���:�:��1�1�$�-�-�@�I��N�N�1�i�(��rec�\�|jduxs|jdk(xr|jS)NTrx)r��is_truncatedr�s rc�should_show_dimensionsz)DataFrameFormatter.should_show_dimensions�s3���#�#�t�+�
�� � �J�.�D�4�3D�3D�	
rec�H�t|jxs|j�Sr�)r��is_truncated_horizontallyror�s rcr�zDataFrameFormatter.is_truncated�s���D�2�2�R�d�6R�6R�S�Srec�t�t|jxr"t|j�|jkD�Sr�)r�r�rir�r�s rcr�z,DataFrameFormatter.is_truncated_horizontally�s,���D�(�(�W�c�$�,�,�.?�$�BV�BV�.V�X�Xrec�t�t|jxr"t|j�|jkD�Sr�)r�r�rir�r�s rcroz*DataFrameFormatter.is_truncated_vertically�s+���D�(�(�U�c�$�*�*�o��@T�@T�.T�V�Vrec�t�dt|j��dt|jj��d�S)Nz

[z rows x z	 columns])rir�r�r�s rc�dimensions_infoz"DataFrameFormatter.dimensions_info�s0���s�4�:�:��'�x��D�J�J�4F�4F�0G�/H�	�R�Rrec�@�t|jj�Sr�)r�r�rTr�s rc�has_index_namesz"DataFrameFormatter.has_index_names�s���$�*�*�*�*�+�+rec�@�t|jj�Sr�)r�r�r�r�s rc�has_column_namesz#DataFrameFormatter.has_column_names�s���$�*�*�,�,�-�-rec�Z�t|j|j|jf�Sr�)�allr�rTr�r�s rc�show_row_idx_namesz%DataFrameFormatter.show_row_idx_namess$���D�(�(�$�*�*�d�6K�6K�L�M�Mrec�Z�t|j|j|jf�Sr�)r�r�r�rSr�s rc�show_col_idx_namesz%DataFrameFormatter.show_col_idx_namess$���D�)�)�4�+@�+@�$�+�+�N�O�Orec��t|jxst|j�t|j��Sr�)rkrYrir�r�s rc�max_rows_displayedz%DataFrameFormatter.max_rows_displayed
s(���4�=�=�3�C��
�
�O�S����_�E�Erec� �|�td�S|S)Nzdisplay.multi_sparse�r)rbr�s  rcr�z'DataFrameFormatter._initialize_sparsifys�����4�5�5��rec���|�iSt|jj�t|�k(st|t�r|Stdt|��dt|jj��d���)NzFormatters length(�+) should match DataFrame number of columns(r�)rir�r�ry�dict�
ValueError)rbr�s  rcr�z)DataFrameFormatter._initialize_formatterssu�����I�
����#�#�
$��J��
7�:�j�RV�;W����$�S��_�$5�6/�/2�4�:�:�3E�3E�/F�.G�q�J��
rec� �|�td�S|S)Nzdisplay.colheader_justifyr�)rbrHs  rcr�z&DataFrameFormatter._initialize_justify s���?��9�:�:��Nrec�t�|�!t|�}|j||_|S|jjSr�)r/r�r�)rbr��colss   rcr�z&DataFrameFormatter._initialize_columns&s7������(�D����D�)�D�J��K��:�:�%�%�%rec�~�|�i}|St|ttf�r:d|i}|j|jj
D�cic]}||��c}�|St|t�rE|j�D].}||jj
vs�|dk7s�"td|����|}|St|jj
�t|�k7r8tdt|��dt|jj
��d���tt|jj
|��}|Scc}w)Nrrz,Col_space is defined for an unknown column: zCol_space length(r�r�)ryrjr��updater�r�r�keysr�rir��zip)rbr�r��columns    rcr�z'DataFrameFormatter._initialize_colspace.s<�����F�$�
�#�	�C��:�
.��)�_�F��M�M�4�:�:�;M�;M�N�;M��6�9�,�;M�N�O��
��	�7�
+�#�.�.�*������!3�!3�3��"��$�F�v�h�O���+�
�F��
�
�4�:�:�%�%�&�#�i�.�8� �'��I��'7�83�36�t�z�z�7I�7I�3J�2K�1�N����#�d�j�j�0�0�)�<�=�F��
��Os�
D:c��|j�s|jSt�\}}|j|�r|S|jS)z%Number of columns fitting the screen.)�_is_in_terminalr�r
�_is_screen_narrow)rbr�r�s   rcr�z(DataFrameFormatter._calc_max_cols_fittedFsA���#�#�%��=�=� �$�&���q��!�!�%�(��L��=�=� rec��|j�rPt�\}}|jdk(r||j�z
S|j	|�r|}n|j}n|j}|j|�S)z,Number of rows with data fitting the screen.r)rr
rY�_get_number_of_auxiliary_rows�_is_screen_short�_adjust_max_rows)rbr�r�rYs    rcr�z(DataFrameFormatter._calc_max_rows_fittedQsr�����!�)�+�I�A�v��}�}��!��� B� B� D�D�D��$�$�V�,�!���=�=���}�}�H��$�$�X�.�.rec�~�|r:t|j�|kDr"|jrt|j|�}|S)z�Adjust max_rows using display logic.

        See description here:
        https://pandas.pydata.org/docs/dev/user_guide/options.html#frequently-used-options

        GH #37359
        )rir�rZrk)rbrYs  rcrz#DataFrameFormatter._adjust_max_rowsds2����D�J�J��(�*��
�
��t�}�}�h�7���rec�T�t|jdk(xs|jdk(�S)z/Check if the output is to be shown in terminal.r)r�r�rYr�s rcrz"DataFrameFormatter._is_in_terminalrs$���D�M�M�Q�&�<�$�-�-�1�*<�=�=rec�z�t|jdk(xr"t|jj�|kD�S�Nr)r�r�rir�r�)rb�	max_widths  rcrz$DataFrameFormatter._is_screen_narrowvs/���D�M�M�Q�&�N�3�t�z�z�/A�/A�+B�Y�+N�O�Orec�f�t|jdk(xrt|j�|kD�Sr)r�rYrir�)rb�
max_heights  rcr
z#DataFrameFormatter._is_screen_shortys(���D�M�M�Q�&�G�3�t�z�z�?�Z�+G�H�Hrec��d}d}||z}|jr&|t|jj��z
}|jr|dz
}|S)z?Get number of rows occupied by prompt, dots and dimension info.rg)r�rir��
splitlinesrS)rb�dot_row�
prompt_row�num_rowss    rcr	z0DataFrameFormatter._get_number_of_auxiliary_rows|sR�����
��Z�'�������D�0�0�;�;�=�>�>�H��;�;���M�H��rec�v�|jr|j�|jr|j�yy)zY
        Check whether the frame should be truncated. If so, slice the frame up.
        N)r��_truncate_horizontallyro�_truncate_verticallyr�s rcrxzDataFrameFormatter.truncate�s3���)�)��'�'�)��'�'��%�%�'�(rec��|j�J�|jdz}|dk\r�|jjdd�d|�f}|jjdd�|d�f}t||fd��|_t	|j
ttf�rlg|j
d|�|j
|d�|_||_ytt|j�}|jjdd�d|�f|_||_y)z�Remove columns, which are not to be displayed and adjust formatters.

        Attributes affected:
            - tr_frame
            - formatters
            - tr_col_num
        Nrhrg��axis)r�r�rlr2ryr��list�tuplerrjr��
tr_col_num)rb�col_numrErFs    rcrz)DataFrameFormatter._truncate_horizontally�s����#�#�/�/�/��&�&�!�+���a�<��=�=�%�%�a��'��k�2�D��M�M�&�&�q�7�(�)�|�4�E�"�D�%�=�q�9�D�M��$�/�/�D�%�=�9�#��_�_�X�g�.�#��_�_�g�X�Y�/�#���"����3��
�
�.�G� �M�M�.�.�q�(�7�(�{�;�D�M�!��rec���|j�J�|jdz}|dk\r|t|j�}tjtj
|�tj
||z
|�g�}|jj||_||_
ytt|j�}|jjd|�dd�f|_||_
y)z�Remove rows, which are not to be displayed.

        Attributes affected:
            - tr_frame
            - tr_row_num
        Nrhrg)r�rir��np�hstack�arangerlrrjrYrm)rbrp�_len�_slices    rcrz'DataFrameFormatter._truncate_vertically�s����#�#�/�/�/��&�&�!�+���a�<��t�}�}�%�D��Y�Y��	�	�'� 2�B�I�I�d�W�n�d�4S�T�U�F� �M�M�.�.�v�6�D�M�"����3��
�
�.�G� �M�M�.�.�x��x��{�;�D�M�!��rec���g}t�j�s��js�t�j�D]m\}}�j	|�}t|�jt�jj|d���j��}|j|��o|St�j�r�ttt�j��_t�j�t�j �k7r8t#dt�j ��dt�j��d����jD�cgc]}|g��}}n�j%�j�}�j&r|D]}|jd��t�j�D]�\}}||}t)t�jj|d��g�fd�|D����}	�j	|�}t|�j|	�j��}t)g�fd	�|D��|	���}
�jj
||
�j�
�}|j||z���|Scc}w)Nr)�stringsrH�minimumr`zWriting z cols but got z aliasesrrc3�T�K�|]}�jj|����!y�wr��r`ri��.0�xrbs  �rc�	<genexpr>z@DataFrameFormatter._get_strcols_without_index.<locals>.<genexpr>�s�����0R�'�Q������a��'���%()r*r`c3�T�K�|]}�jj|����!y�wr�r,r-s  �rcr0z@DataFrameFormatter._get_strcols_without_index.<locals>.<genexpr>�s�����@�Z��D�H�H�L�L��O�Z�r1r�)rrS�	enumerater��
format_col�_make_fixed_widthrHrjr��getr`�appendrrr�rir�r��_get_formatted_column_labelsr��max)rbr��i�cr��label�str_columnsr/�cheader�header_colwidth�max_lens`          rcr�z-DataFrameFormatter._get_strcols_without_index�s���#%���D�K�K�(����!�$�-�-�0���1�!�_�_�Q�/�
�.�&� �L�L����� 2� 2�1�a� 8�9����	�
����z�*�1��N�����$��t�C�y�$�+�+�6�D�K��4�;�;��3�t�|�|�#4�4� ��s�4�<�<�0�1�2�"�4�;�;�/�0��:���15���<��u�E�7��K�<��;�;�D�M�M�J�K��"�"� �������!��d�m�m�,�D�A�q�!�!�n�G�!��D�N�N�&�&�q�!�,�-��0R�'�0R��O�����+�J�*��D�L�L�/�t�x�x��J��R�@�Z�@�R�/�R�G��h�h�&�&�w��d�l�l�&�K�G��N�N�7�Z�/�0�-����-=s�
Jc
�2�|j}|j|�}t|jdd�|fj||j
|j|jj|j|�|j|j��S)N)rWrU�spacer�r�)r��_get_formatterr�rlr~rWrUr�r6r�r�rT)rbr:r��	formatters    rcr4zDataFrameFormatter.format_col�sz���
�
���'�'��*�	���J�J�q�!�t��$�$���*�*��;�;��.�.�$�$�U�]�]�1�%5�6��L�L��*�*�
�	
rec� �t|jttf�r+t	|�rtt|�}|j|Syt	|�r||jvr|j|}|jj|d�Sr�)	ryr�rrrrrjr�r6)rbr:s  rcrCz!DataFrameFormatter._get_formatter�sn���d�o�o��e�}�5��!�}���a�L�����q�)�)���!�}��$�,�,�!6��L�L��O���?�?�&�&�q�$�/�/rec	�6��
���ddlm}|j}t|t�r�|jdd��}t
t|��}�jjj}td�|jD���tt|tt|����
�
��fd��t
t�fd�|D���}�j rt#|�r||�}t|�D�cgc]
}t
|���}}|S|j%d��}�jj}tt|tt|����
t'|�D�	�cgc]#\}	}�j)|	�s
�
|rd	|zn|g��%}}	}|Scc}wcc}}	w)
Nr)�sparsify_labelsF)r�r�c3�4K�|]}|j���y�wr�)�is_floating)r.�levels  rcr0zBDataFrameFormatter._get_formatted_column_labels.<locals>.<genexpr>s����%T�^�E�e�&7�&7�^�s�c�<��|�jvr�|r�sd|zS|S)N� )r�)r/�y�need_leadsp�restrict_formattingrbs  ���rc�space_formatzEDataFrameFormatter._get_formatted_column_labels.<locals>.space_formats'����T�_�_�,�#�A��/���7�N��rec3�V�K�|]}|D�cgc]}�||���
c}���ycc}w�wr�r�)r.r/rMrPs   �rcr0zBDataFrameFormatter._get_formatted_column_labels.<locals>.<genexpr> s+�����K�{�!�1�5�1�a�|�A�q�)�1�5�{��5�s�	)�$�
)r�rL)�pandas.core.indexes.multirGr�ryr-r�rrr��dtypesr~�any�levelsr��maprr�rir�r3rC)
rbr�rGr��fmt_columnsrS�str_columns_tupler/r=r:rNrOrPs
`         @@@rcr8z/DataFrameFormatter._get_formatted_column_labelss~���=��-�-���g�z�*�!�/�/��e�/�T�K��s�K�0�1�K��Z�Z�&�&�.�.�F�#&�%T�W�^�^�%T�"T���s�;��4D�f�0M�N�O�K�
�!%��K�{�K�L�!���}�}��%6�!7�$3�4E�$F�!�,/�1B�,C�D�,C�q�4��7�,C�K�D���"�.�.�E�.�B�K��Z�Z�&�&�F��s�;��4D�f�0M�N�O�K�&�k�2��2�D�A�q�!%� 3� 3�A� 6�;�q�>��q��q�Q�2�
��
���E��
s�4F�#(Fc
�,�|jj�D��cic]\}}|tt|���}}}|j}|j
}|j
d�}t|t�r)|j|j|j|��}n|j|j|��g}|D�	cgc]=}	ttt|	�d|j!dd�|j"�����?}}	|j"j$dg|���j'd	�}
|j(r'|j+�D�	cgc]
}	t-|	���}}	ndg|j.z}|j0r||
zS|
Scc}}wcc}	wcc}	w)
N�	__index__)r�r�rD)r�rDrErrr)rHr*r`rgrv)r��itemsrrjrTr�rCryr-r�r�r�r�rr5rr6r`r�r�r��_get_column_name_listr��nlevelsrS)rbr��k�vr�rTr��fmtr�r/�adjoined�
col_headers            rcr�z'DataFrameFormatter._get_formatted_index1s���26���1E�1E�1G�H�1G���A�Q��S�!��_�1G�	�H������-�-���!�!�+�.���e�Z�(��+�+����"�5�5��,��I��"�"��0G�0G�SV�"�W��I��

���
�!���G�V�Y�]�]�2�q�5I�t�x�x��
�
�
	�
�#�4�8�8�?�?�1�1�y�1�7�7��=���"�"�*.�*D�*D�*F�G�*F�Q�#�a�&�*F�J�G������/�J��;�;���(�(��O��II�� 
��Hs�F�AF�Fc���g}|jj}t|t�r$|j	d�|j
D��|S|j
|j�dn|j�|S)Nc3�(K�|]
}|�dn|���y�w)Nrrr�)r.rVs  rcr0z;DataFrameFormatter._get_column_name_list.<locals>.<genexpr>^s����P�-�$�t�|���5�-�s�rr)r�r�ryr-�extend�namesr7rV)rbrfr�s   rcr\z(DataFrameFormatter._get_column_name_listZs_�� "���*�*�$�$���g�z�*��L�L�P�'�-�-�P�P���
�L�L�w�|�|�3�����F��re)NNTTrQNNNNTNNNF�.FT)&r�rBr��Axes | Noner��ColspaceArgType | NonerSzbool | SequenceNotStr[str]rTr�rUr�r��FormattersType | NonerHr�rW�FloatFormatType | Noner��bool | Noner�r�rYr�rZr�r�r�r�r�r�r�r�r�r�r�r�r�)r��list[list[str]]�r�r�r�)r�rj)r�rlr�r�)r�rjr�r=)rHr�r�r�)r�rhr�r,)r�rir�r9)r�r�)rYr�r�r�r�)r:rjr�r�)r:�	str | intr��Callable | None)r�rBr�rm)r�rBr�r�)r�zlist[Hashable])(r�r�r�r�rDrNrdr��propertyr�r�r�ror�r�r�r�r�r�r�r�r�r�r�r�r�rrrr
r	rxrrr�r4rCr8r�r\r�rercr�r��ss���!�g�b�G���"2�2�2�G�
 $�,0�-1���,0�"�/3� $� �#�#�#�&+����'--��--��--�*�	--�
+�--��
--��--�*�--��--�-�--��--��--��--��--��--� $�!--�"�#--�$�%--�&�'--�(
�)--�^
��
��
�
�T��T��Y��Y��W��W��S��S��,��,��.��.��N��N��P��P��F��F��
�/��	���&��0	!�/�&�>�P�I��(�"�4"�$-�^
�
0�'�R'�Rrer�c���eZdZdZdd�Z							d															d	d�Z			d
							dd�Z																d																																	d
d�Zy)�DataFrameRendereraJClass for creating dataframe output in multiple formats.

    Called in pandas.core.generic.NDFrame:
        - to_csv
        - to_latex

    Called in pandas.core.frame.DataFrame:
        - to_html
        - to_string

    Parameters
    ----------
    fmt : DataFrameFormatter
        Formatter with the formatting options.
    c��||_yr�)r`)rbr`s  rcrdzDataFrameRenderer.__init__us	����reNc��ddlm}m}	|r|	n|}
|
|j||||��}|j	�}t|||��S)uJ
        Render a DataFrame to a html table.

        Parameters
        ----------
        buf : str, path object, file-like object, or None, default None
            String, path object (implementing ``os.PathLike[str]``), or file-like
            object implementing a string ``write()`` function. If None, the result is
            returned as a string.
        encoding : str, default “utf-8”
            Set character encoding.
        classes : str or list-like
            classes to include in the `class` attribute of the opening
            ``<table>`` tag, in addition to the default "dataframe".
        notebook : {True, False}, optional, default False
            Whether the generated HTML is for IPython Notebook.
        border : int
            A ``border=border`` attribute is included in the opening
            ``<table>`` tag. Default ``pd.options.display.html.border``.
        table_id : str, optional
            A css id is included in the opening `<table>` tag if specified.
        render_links : bool, default False
            Convert URLs to HTML links.
        r)�
HTMLFormatter�NotebookFormatter)�classes�border�table_id�render_links�r^�encoding)�pandas.io.formats.htmlrvrwr`r��save_to_buffer)
rbr^r}rx�notebookryrzr{rvrw�Klass�html_formatter�strings
             rc�to_htmlzDataFrameRenderer.to_htmlxsP��D	
�
&.�!�=����H�H����%�
�� �)�)�+���f�#��A�Arec�r�ddlm}||j|��}|j�}t	|||��S)u%
        Render a DataFrame to a console-friendly tabular output.

        Parameters
        ----------
        buf : str, path object, file-like object, or None, default None
            String, path object (implementing ``os.PathLike[str]``), or file-like
            object implementing a string ``write()`` function. If None, the result is
            returned as a string.
        encoding: str, default “utf-8”
            Set character encoding.
        line_width : int, optional
            Width to wrap a line in characters.
        r)�StringFormatter)r�r|)�pandas.io.formats.stringr�r`r�r)rbr^r}r�r��string_formatterr�s       rcr�zDataFrameRenderer.to_string�s5��(	=�*�4�8�8�
�K��!�+�+�-���f�#��A�Arec�D�ddlm}|�
d}t�}nd}|did|�d|
�d|�d	|�d
|�d|�d|�d
|�d|�d|�d|�d|	�d|�d|
�d|�d|�d|j��}|j	�|r4t|t�sJ�|j
�}|j�|Sy)z;
        Render dataframe as comma-separated file.
        r)�CSVFormatterNTF�path_or_buf�lineterminator�sepr}�errors�compression�quotingr��index_labelr��	chunksize�	quotechar�date_format�doublequote�
escapechar�storage_optionsrDr�)�pandas.io.formats.csvsr�rr`�savery�getvalue�close)rbr�r}r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��created_buffer�
csv_formatter�contents                     rc�to_csvzDataFrameRenderer.to_csv�s��,	8���!�N�"�*�K�"�N�$�
�#�
�)�
��
��	
�
�
�$�

��
��
�$�
��
� �
� �
�$�
�$�
�"�
� ,�!
�"�h�h�#
�
�&	������k�8�4�4�4�!�*�*�,�G������N�re)r`r�r�r�)NNNFNNF)r^�"FilePath | WriteBuffer[str] | Noner}r�rxzstr | list | tuple | Noner�r�ryzint | bool | Nonerzr�r{r�r�r�)NNN)r^r�r}r�r�r�r�r�)NN�,NN�w�inferN�"NNNTN�strictN)"r�z7FilePath | WriteBuffer[bytes] | WriteBuffer[str] | Noner}r�r�r�r�zSequence[Hashable] | Noner�zIndexLabel | Noner�r�r�r:r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�zStorageOptions | Noner�r�)r�r�r�r�rdr�r�r�r�rercrsrsds���� �
37�#�-1��$(�#�"�1B�
/�1B��1B�+�	1B�
�1B�"�
1B��1B��1B�
�1B�j37�#�!%�	B�
/�B��B��	B�

�B�8PT�#��-1�)-��*1�"��%)� $�"&� �!%��15�#9�L�9��9��	9�
+�9�'�
9��9�(�9��9��9�#�9��9� �9��9��9� �!9�"/�#9�$
�%9rersc��t||��5}|j|�|�|j�cddd�S	ddd�y#1swYyxYw)zQ
    Perform serialization. Write to buf or return as string if buf is None.
    )r}N)�_get_buffer�writer�)r�r^r}�fds    rcrrsC��
�S�8�	,��
������;��;�;�=�	
-�	,�
�
-�	,�	,�s�#A�A�Ac#�LK�|�t|�}n
t�}|�d}nt|t�st	d��t|d�r|��yt|t�r1t
t|��t|d|d��5}|��ddd�ytd��#1swYyxYw�w)	z�
    Context manager to open, yield and close buffer for filenames or Path-like
    objects, otherwise yield buf unchanged.
    Nzutf-8z1buf is not a file name and encoding is specified.r�r�rr)r}�newlinez1buf is not a file name and it has no write method)	r4rryr�r��hasattrr3�open�	TypeError)r^r}�fs   rcr�r�s��������S�!���j������
��S�
!��L�M�M��s�G���	�	�C��	��s�3�x�(�
�#�s�X�r�
:�a�
�G�;�
:��K�L�L�;�
:�s�A=B$�?B�B$�B!�B$c
��tj|jd�rt}t	t
|�}n�t
|jt�rt}t	t
|�}n�tj|jd�rt}t	t|�}nut
|jt�rt}nTtj|jd�rt}n-tj|jd�rt}nt}|�d}|�t!d�}|�t!d�}|||||||||||	|
��}|j#�S)	a�
    Format an array for printing.

    Parameters
    ----------
    values : np.ndarray or ExtensionArray
    formatter
    float_format
    na_rep
    digits
    space
    justify
    decimal
    leading_space : bool, optional, default True
        Whether the array should be formatted with a leading space.
        When an array as a column of a Series or DataFrame, we do want
        the leading space to pad between columns.

        When formatting an Index subclass
        (e.g. IntervalIndex._get_values_for_csv), we don't want the
        leading space since it should be left-aligned.
    fallback_formatter

    Returns
    -------
    List[str]
    �M�m�fc�iu�r\�display.precision)
�digitsrUrWrDrBrHr�r�r��fallback_formatter)r�is_np_dtyperX�_Datetime64Formatterrr'ryr"�_Datetime64TZFormatter�_Timedelta64Formatterr)r#�_ExtensionArrayFormatter�FloatArrayFormatter�_IntArrayFormatter�_GenericArrayFormatterr�
get_result)
�valuesrDrWrUr�rBrHr�r�r�r��	fmt_klass�fmt_objs
             rcr�r�7s��R���v�|�|�S�)�(�	��m�V�,��	�F�L�L�/�	2�*�	��m�V�,��	������s�	+�)�	��n�f�-��	�F�L�L�.�	1�,�	�	������t�	,�'�	�	������t�	,�&�	�*�	��}�����!�"8�9��
�~��/�0������!�����#��-��G�����rec�n�eZdZ											d																									dd�Zdd�Zdd�Zy)r�Nc
��||_||_||_||_||_||_||_||_|	|_|
|_	||_
||_yr�)r�r�rUrBrDrWrHr�r��fixed_widthr�r�)
rbr�r�rDrUrBrWrHr�r�r�r�r�s
             rcrdz_GenericArrayFormatter.__init__�s\�������������
�"���(������������&���*���"4��rec�N�|j�}t||j�Sr�)�_format_stringsr5rH)rbr�s  rcr�z!_GenericArrayFormatter.get_result�s!���)�)�+�
� ��T�\�\�:�:rec�����
��j�td�}|�td��
�
fd�}n�j}�j�
�j�nX�j�
�j�n?�jduxr�jt
k7}t
tjd|�����fd�}�j}t|tj�std��tj|t �}|tj"t%|�t't)dt+|j,����	�z}�j.}|�|j1�}g}t3|�D]�\}	}
||	r�j�|r|j5d
||
�����4||	r|j5||
���Q|durd}nd
}|j5|j7||
������|S)Nr\r�c�(��t|d�d�d���S)Nz .�dr�)�_trim_zeros_single_float)r/�	precisions �rc�<lambda>z8_GenericArrayFormatter._format_strings.<locals>.<lambda>�s���)A���I�a�=��)�*�*rers)rw�
quote_stringsc�����j��t|�r�t|�r�|�y|turt	t�Stj|�r tj|�rt	|�S|tus*t|tjtjf�ry�jSt|t�rt	|�St|t�rt|�St	�|��S)Nr�r)rUr r$rr�rrr#�isinfrry�
datetime64�timedelta64r+r*�repr)r/rDrbs ��rc�_formatz7_GenericArrayFormatter._format_strings.<locals>._format�s�����{�{�&�9�Q�<�D��G��9�!��"�W��r�7�N��\�\�!�_����!���q�6�M��#�X��A��
�
�r�~�~�/N�!O� ��{�{�"��A�|�,��1�v�
��A�{�+��A�w���9�Q�<�(�(rez=ExtensionArray formatting should use _ExtensionArrayFormatterrgrrLFz{v}z {v})r_)rWrrDr�r�r	rr5r|r�ryr#�ndarrayr�r�	map_inferrr�r%r�rangeri�shaper�rTr3r7�format)rbrWr�r��vals�inferred�
is_float_typer�r�r:r_�tplrDr�s`           @@rcr�z&_GenericArrayFormatter._format_strings�s�������$�%�&<�=�L��#�&�':�;�	� �� �,�,�L��>�>�%����I�
�
$�
$�
0��/�/�I� �L�L��4�S�����9S�M���%�%�/�+��I�	)�*�{�{���$��
�
�+��O��
��=�=��x�0����f�f�U�4�[�u�U�1�c�$�*�*�o�-F�'G�H�
I�	�
�*�*�
�� �)�-�-�/�M��
��d�O�D�A�q�!�!�$����(B�
��!�!�A�g�a�j�\�"2�3��q�!��!�!�,�q�/�2� �E�)� �C� �C��!�!�#�*�*�w�q�z�*�":�;�$��re)�NrQr�NrFrgNTTN)r�r6r�rjrDrprUr�rBrorWrkrHr�r�r�r�r�r�r�r�rlr�rpr�r�r�)r�r�r�rdr�r�r�rercr�r��s����%)���/3���"� �%)�.2�5��5��5�#�	5�
�5��
5�-�5��5��5��5��5�#�5�,�5�
�5�8;�Jrer�c�H��eZdZd�fd�Z		d					dd�Zdd�Zd	d�Z�xZS)
r�c����t�|�|i|��|j�C|j�6d|_t|j�r|j|_d|_yyyy�NF)�superrdrWrDr��callable)rb�args�kwargs�	__class__s   �rcrdzFloatArrayFormatter.__init__�se���
���$�)�&�)����(�T�^�^�-C�$�D����)�)�*�!%�!2�!2���$(��!�+�.D�(rec����������j��r��fd��n�fd���jdk7r��fd��n�����S���fd�}|S)z;Returns a function to be applied on each value to format itc�L����J�t|�r	�|��S�jS)N)�value)r%rU)r_rWrbs ��rc�base_formatterz<FloatArrayFormatter._value_formatter.<locals>.base_formatters5���#�/�/�/��Q�x�!�q�)�����rec�H��t|�rt|�S�jSr�)r%r�rU)r_rbs �rcr�z<FloatArrayFormatter._value_formatter.<locals>.base_formatter&s���!&�q��s�1�v�:�t�{�{�:rergc�J���|�jd�jd�S)Nrgrg)�replacer�)r_r�rbs ��rc�decimal_formatterz?FloatArrayFormatter._value_formatter.<locals>.decimal_formatter+s!���%�a�(�0�0��d�l�l�A�F�Frec�n��t|�rt|��kDr�|�S�d�S�jS)Ng)r%�absrU)r�r�rb�	thresholds ���rcrDz7FloatArrayFormatter._value_formatter.<locals>.formatter4s6����U�|��u�:�	�)�,�U�3�3�,�S�1�1��{�{�"re)rWr�)rbrWr�rDr�r�s``` @@rc�_value_formatterz$FloatArrayFormatter._value_formattersZ������,�,�L��	
�
;��<�<�3��
G�!/����$�$�	#��rec�`��
���dd��						dd��
�j�(��j�j�j�S�jrt	d��nd��
���fd�}�j
�N�jr5�jdurd}nd}t|j�j�	�}n�j
}n�fd
�}||�}�js|St|�dkDr%td�|D��}|�jd
zkD}nd}tj�j�}|dkDj�}|d�jzk|dkDzj�}	|	s|r>|r<�jdurd}nd}t|j�j�	�}||�}|S)z�
        Returns the float values converted into strings using
        the parameters given at initialisation, as a numpy array
        c	�
�t|�}tjt|j	�|j	��D��cgc]\}}|s||�n|��c}}�j|j�}|Scc}}wr�)r$r#�arrayr�ravel�reshaper�)r�rDrU�mask�valr��	formatteds       rc�format_with_na_repzCFloatArrayFormatter.get_result_as_array.<locals>.format_with_na_repEsx����<�D����#&�f�l�l�n�d�j�j�l�"C��"C���Q�+,�I�c�N��7�"C���
�g�f�l�l�#�
����s�A?
c��tj|�j�}tj|�j�}t	|�t	|�}}g}t|j�||||�D]�\}}	}
}}|s|s|j
||���%|s|j
||	��d|�d���E|sV||
�j�}
|
jd�r|j
|�|
�d����|j
|�d|
�d����|j
|�d|�d����tj|�j|j�S)N�+�j�-)r#�realr��imagr$rr7�strip�
startswithr�r�r�)r�rDrU�real_values�imag_values�	real_mask�	imag_mask�
formatted_lstr��real_val�imag_val�re_isna�im_isna�imag_formatteds              rc�format_complex_with_na_repzKFloatArrayFormatter.get_result_as_array.<locals>.format_complex_with_na_repOsI���'�'�&�/�/�/�1�K��'�'�&�/�/�/�1�K�#'��#4�d�;�6G�y�I��M�=@���������>�9��X�x��'��w�!�(�(��3��8� �!�(�(�I�h�,?�+@��&���)K�L� �%.�x�%8�%>�%>�%@�N�%�0�0��5�%�,�,��x��7G�q�-I�J�%�,�,��x�q��8H��-J�K�!�(�(�F�8�1�V�H�A�)>�?�'>�(�8�8�M�*�2�2�6�<�<�@�@reNzdisplay.chop_thresholdc����j|�	�}�jdk(rd�jzn�j}�j}t	|�}|r�|||�}n
�|||�}�j
rF|rt
|�j�}nt|�j�}tj|d��S|S)NrErL�object�rX)r�rHrUr�rr��_trim_zeros_complexr��_trim_zeros_floatr#�asarray)
rWrDrUr��
is_complexr�rr�rbr�s
      ����rc�format_values_withzCFloatArrayFormatter.get_result_as_array.<locals>.format_values_withus�����-�-�l�I�F�I�+/�,�,�&�*@�S�4�;�;�&�d�k�k�F��[�[�F�)�&�1�J��3�F�I�v�N��+�F�I�v�F������0�����F�F�.�v�t�|�|�D�F��z�z�&��9�9��MreTz{value: .{digits:d}f}z{value:.{digits:d}f})r�c�"���j|zSr�)rW)r�rbs �rcr�z9FloatArrayFormatter.get_result_as_array.<locals>.<lambda>�s����):�):�U�)Brerc3�2K�|]}t|����y�wr��ri�r.r/s  rcr0z:FloatArrayFormatter.get_result_as_array.<locals>.<genexpr>�s����:�)9�A��Q��)9����Fg��.A�
z{value: .{digits:d}e}z{value:.{digits:d}e})r�r6rDrrUr�)rDr�rUr�rrWr�rr�r�rir9r#r�rT)
rbr�fmt_strrW�formatted_values�maxlen�too_long�abs_vals�has_large_values�has_small_valuesrr�r�s
`         @@@rc�get_result_as_arrayz'FloatArrayFormatter.get_result_as_array?s����	�	A��	A�*2�	A�<?�	A�:�>�>�%�%�d�k�k�4�>�>�4�;�;�O�O����"�#;�<�I��I�	�<���$�����%�%��-�5�G�4�G�&�w�~�~�d�k�k�J��#�0�0��B�L�-�l�;�����#�#��� �1�$��:�)9�:�:�F�����a��/�H��H��6�6�$�+�+�&��%�s�N�/�/�1��%�����|�(<�<��A��N�S�S�U����-=��!�!�T�)�1��0��"�7�>�>�$�+�+�F�L�1�,�?���rec�4�t|j��Sr�)rr'r�s rcr�z#FloatArrayFormatter._format_strings�s���D�,�,�.�/�/rer��NN)rWrkr�zfloat | Noner�r)r�z
np.ndarrayr�)r�r�r�rdr�r'r��
__classcell__�r�s@rcr�r��s>���
)�04�"&�6�,�6� �6�
�	6�p~ �@0rer�c��eZdZdd�Zy)r�c��|jdurd�}nd�}|jxs|}|jD�cgc]
}||���}}|Scc}w)NFc�*�|d�j|��S)Nr��r/�r�r/s rcr�z4_IntArrayFormatter._format_strings.<locals>.<lambda>�s���1��o�o��o�&:rec�*�|d�j|��S)Nz dr/r0r/s rcr�z4_IntArrayFormatter._format_strings.<locals>.<lambda>�s���2��&6�&6��&6�&;re)r�rDr�)rb�
formatter_strrDr/r�s     rcr�z"_IntArrayFormatter._format_strings�sO������&�:�M�;�M��N�N�3�m�	�,0�K�K�8�K�q�i��l�K�
�8����9s�ANr�)r�r�r�r�r�rercr�r��s��rer�c�H��eZdZUded<		d							d�fd�
Zdd�Z�xZS)r�r'r�c�B��t�|�|fi|��||_||_yr�)r�rd�nat_repr�)rbr�r5r�r�r�s     �rcrdz_Datetime64Formatter.__init__�s&���	����*�6�*����&��rec���|j}|j�|D�cgc]}|j|���c}S|j|j|j��}|j�Scc}w)z&we by definition have DO NOT have a TZ)rUr�)r�rD�_format_native_typesr5r��tolist)rbr�r/r�s    rcr�z$_Datetime64Formatter._format_strings�sm�������>�>�%�/5�6�v�!�D�N�N�1�%�v�6�6��0�0��<�<�T�-=�-=�1�
�
�� � �"�"��7s�A/�rN)r�r'r5r�r�r�r�r�r��r�r�r��__annotations__rdr�r*r+s@rcr�r��sA�����
� �		'��	'��	'��		'�
�
	'�
#rer�c� �eZdZUded<dd�Zy)r�r(r�c
��|j}|j}d}|�|jd��}t|t�r|j�}nt
j|t��}t|||j|j|j|j|j|j|j |j"|��}|S)NT)�boxedr)	rWrUr�rBrHr�r�r�r�)r�rD�
_formatterryr&�_internal_get_valuesr#rrr�rWrUr�rBrHr�r�r�)rbr�rDr�r�r�s      rcr�z(_ExtensionArrayFormatter._format_strings�s��������N�N�	�!����!'�!2�!2��!2�!>���f�k�*��/�/�1�E��J�J�v�V�4�E�!����*�*��;�;��;�;��*�*��L�L��L�L��,�,��L�L�1�
�
��reNr��r�r�r�r;r�r�rercr�r��s
����rer�c�F�tj|�}t|�r0tj|dk\�rtj|dk�st	d��d|z}t|�}|j
|�jt�}tj||�}tj|�r(|jt�}|D�cgc]}|dz��	c}Stj|�}t|�}tj|t��}||j
�jt�jt�||<||j
|�jt�||<|D�cgc]}|dz��	c}Scc}wcc}w)a
    Outputs rounded and formatted percentiles.

    Parameters
    ----------
    percentiles : list-like, containing floats from interval [0,1]

    Returns
    -------
    formatted : list of strings

    Notes
    -----
    Rounding precision is chosen so that: (1) if any two elements of
    ``percentiles`` differ, they remain different after rounding
    (2) no entry is *rounded* to 0% or 100%.
    Any non-integer is always rounded to at least 1 decimal place.

    Examples
    --------
    Keeps all entries different after rounding:

    >>> format_percentiles([0.01999, 0.02001, 0.5, 0.666666, 0.9999])
    ['1.999%', '2.001%', '50%', '66.667%', '99.99%']

    No element is rounded to 0% or 100% (unless already equal to it).
    Duplicates are allowed:

    >>> format_percentiles([0, 0.5, 0.02001, 0.5, 0.666666, 0.9999])
    ['0%', '50%', '2.0%', '50%', '66.67%', '99.99%']
    rrgz/percentiles should all be in the interval [0,1]�d�%r)r#rrr�r��
get_precision�round�astyperj�iscloser��unique�
empty_liker)�percentiles�prec�percentiles_round_type�int_idx�outr:�unique_pctss       rc�format_percentilesrQ
s`��D�*�*�[�)�K�
�[�)��v�v�k�Q�&�'��v�v�k�Q�&�'��J�K�K���#�K���%�D�(�.�.�t�4�;�;�C�@���j�j�/��=�G�	�v�v�g��$�+�+�C�0��!$�%��A��C���%�%��)�)�K�(�K���%�D�
�-�-��6�
2�C��w�'�-�-�/�6�6�s�;�B�B�3�G�C��L����)�/�/��5�<�<�S�A�C���M� �!�S��A��G�S�!�!��&��"s�F�
Fc�D�|ddkDr|dnd}|ddkrd|dz
nd}tj|||��}t|�}tjtjtj
|���j
t�}td|�}|S)Nr���rC)�to_begin�to_endrg)	r#�ediff1dr��floor�log10rkrGrjr9)r�rTrU�diffrLs     rcrErEIs��� ��8�a�<�u�Q�x�T�H� %�b�	�C��S�5��9�_�T�F�
�:�:�e�h�v�>�D��t�9�D��H�H�R�X�X�b�f�f�T�l�+�,�3�3�C�8�8�D��q�$�<�D��Krec�,�|tur|St|�Sr�)rr��r/r5s  rc�_format_datetime64r\Ss���C�x����q�6�Mrec�d�t|t�r|S|r|j|�S|jSr�)ryr�strftime�
_date_repr)r/r5r�s   rc�_format_datetime64_dateonlyr`\s1��
�!�W������z�z�+�&�&��|�|�rec� ���|r��fd�S�fd�S)z]Return a formatter callable taking a datetime64 as input and providing
    a string as outputc� ��t|����S)N)r5r�)r`)r/r�r5s ��rcr�z'get_format_datetime64.<locals>.<lambda>rs���4�
�w�K�
rec���t|���S)N)r5)r\r[s �rcr�z'get_format_datetime64.<locals>.<lambda>vs
���+�A�w�?rer�)�
is_dates_onlyr5r�s ``rc�get_format_datetime64reks����
�	
�@�?rec� �eZdZUded<dd�Zy)r�r'r�c���|jj}|jjt�}|jxst||j��}|D�cgc]
}||���}}|Scc}w)zwe by definition have a TZ)r�)r��_is_dates_onlyrGrrDrer�)rb�idor�rDr/r�s      rcr�z&_Datetime64TZFormatter._format_strings|sk���k�k�(�(�����#�#�F�+���N�N�
�&;��T�-�-�'
�	�-3�3�F�q�i��l�F�
�3����4s�A2Nr�rAr�rercr�r�ys
����	rer�c�B��eZdZUded<	d					d�fd�
Zdd�Z�xZS)r�r)r�c�4��t�|�|fi|��||_yr�)r�rdr5)rbr�r5r�r�s    �rcrdz_Timedelta64Formatter.__init__�s���	����*�6�*���rec��|jxs"t|j|jd��}|jD�cgc]
}||���c}Scc}w)NF)r5�box)rD�get_format_timedelta64r�r5)rbrDr/s   rcr�z%_Timedelta64Formatter._format_strings�sI���N�N�
�&<��K�K����5�'
�	�'+�k�k�2�k��	�!��k�2�2��2s�A�r)r�r)r5r�r�r�r�r:r+s@rcr�r��s4�����
������

��3rer�c�@����|j}|rd�nd����fd�}|S)z�
    Return a formatter function for a range of timedeltas.
    These will all have the same format argument

    If box, then show the return in quotes
    N�longc���|�t|�r
t|�r�St|t�st|�}|j	���}�rd|�d�}|S)Nr0�')r r$ryr�
_repr_base)r/r�rmr�r5s  ���rcr?z*get_format_timedelta64.<locals>._formatter�sS����9��1��$�q�'��N��!�Y�'��!��A����V��,�������]�F��
re)rh)r�r5rm�	even_daysr?r�s ``  @rcrnrn�s*����%�%�I��������rec�@���	�t|�dk(s|dk(r|S|�tj��n|�t�fd�|D���	|�t|�	��	t	d�����	�kDr��	d���	fd�}|D�cgc]
}||���}}�j|�	|��}|Scc}w)Nrr�c3�@�K�|]}�j|����y�wr�r)r.r/�
adjustments  �rcr0z$_make_fixed_width.<locals>.<genexpr>�s�����5�W��*�.�.��#�W�s�r�c�V����%�dkD�j|��kDzr|d�dz
dz}|S)Nr�r�r)r/rx�conf_maxr@s ���rc�justz_make_fixed_width.<locals>.just�s=������1������!2�W�!<�=��m��!��$�u�,���rer�)r/r�r�r�)rir5r_r9rrH)
r)rHr*r`r{r/r�rxrzr@s
       @@@rcr5r5�s�����7�|�q��G�u�,���
�{��,�,�.�
��
��5�W�5�5�G����g�w�'���0�1�H����(� 2����!(�(��1�t�A�w��G�(�
�
�
���w�
�
?�F��M��)s�4Bc���gg}}|D]^}tjd|�}|jdj|dd��|jdj|dd���`t	|�}t||z|�}t	|�dk(rgSt
d�|D��dz
}t|d|||d�D�	�
cgc]\}	}
|	|
dz|
ddd	|���zd
z��}}	}
|Scc}
}	w)z�
    Separates the real and imaginary parts from the complex number, and
    executes the _trim_zeros_float method on each of those.
    z([j+-])rrN������rc3�2K�|]}t|����y�wr�r)r.�parts  rcr0z&_trim_zeros_complex.<locals>.<genexpr>�s����;�l�d��D�	�l�rrg�>r)�rer�r7r�rirr9r)�
str_complexesr��	real_part�	imag_partr/�trimmed�n�padded_parts�
padded_length�real_pt�imag_pt�paddeds            rcrr�s%��
�r�y�I�
��
�(�(�:�q�)����������"��.�/���������B��0�1��	�M��A�$�Y��%:�G�D�L�
�<��A���	��;�l�;�;�a�?�M�!$�L��!�$4�l�1�2�6F� G��
!H��G�W�		�
�!�*�	�
�Q�R�[��=�/�)�*�	,��	�!H����M��s�< C!c�T�|jd�}|jd�r|dz
}|S)zX
    Trims trailing zeros after a decimal point,
    leaving just one if necessary.
    �0rg)�rstrip�endswith)�	str_floats rcr�r�s2��
� � ��%�I����#���S��	��rec� ���|}tjd|�d���d�fd��d	�fd�}||�r%|D�cgc]}�|�r|ddn|��}}||�r�%|D�cgc]"}�|�r|j|�r|dzn|��$}}|Scc}wcc}w)
z�
    Trims the maximum number of trailing zeros equally from
    all numbers containing decimals, leaving just one if
    necessary.
    z^\s*[\+-]?[0-9]+\z[0-9]*$c�4��tj�|�duSr�)r��match)r/�number_regexs �rc�is_number_with_decimalz1_trim_zeros_float.<locals>.is_number_with_decimals����x�x��a�(��4�4rec���|D�cgc]
}�|�s�|��}}t|�dkDxrtd�|D��Scc}w)z�
        Determine if an array of strings should be trimmed.

        Returns True if all numbers containing decimals (defined by the
        above regular expression) within the array end in a zero, otherwise
        returns False.
        rc3�>K�|]}|jd����y�w)r�N)r�rs  rcr0z9_trim_zeros_float.<locals>.should_trim.<locals>.<genexpr>$s����'I��A��
�
�3���s�)rir�)r�r/�numbersr�s   �rc�should_trimz&_trim_zeros_float.<locals>.should_trimsF���%�B�f��(>�q�(A�1�f��B��7�|�a��I�C�'I��'I�$I�I��Cs�
<�<NrSr�rn)r��ArrayLike | list[str]r�r�)r��compiler�)�
str_floatsr�r�r�r/r�r�r�s      @@rcrr
s�����G��:�:�!2�7�)�7�C�D�L�5�	J��g�
�GN�O�w�!�3�A�6�1�S�b�6�A�=�w��O��g�
����A�*�!�,����G�1D��C��!�K�����M��P��s�B�'Bc�v�t|t�rtj|j�S|j
duSr�)ryr-�com�any_not_nonerfrV)rTs rcr�r�1s0���%��$�������-�-��z�z��%�%rec��eZdZdZidd�dd�dd�dd	�d
d�dd
�dd�dd�dd�dd�dd�dd�dd�dd�dd�d d!�d"d#�Z	d'					d(d%�Zd)d&�Zy$)*�EngFormatterzl
    Formats float values according to engineering format.

    Based on matplotlib.ticker.EngFormatter
    i��rMi���zi���ai�r�i��pi����r�i�����u���r�rrrr�r^rr��	�Gr��T��P��E��Z��YNc� �||_||_yr���accuracy�use_eng_prefix)rbr�r�s   rcrdzEngFormatter.__init__Ts��!��
�,��rec���tt|��}tj|�rytj|�ryd}|dkrd}|}|dk7r<tt	tj|j�dz�dz��}ntd�}|jt|jj���}|jt|jj���}t	|�}|jr|j|}n|dkrd|d��}nd	|d��}||zd
|zz}|j�d}nd|jd
�d�}|j||��}	|	S)a�
        Formats a number in engineering notation, appending a letter
        representing the power of 1000 of the original number. Some examples:
        >>> format_eng = EngFormatter(accuracy=0, use_eng_prefix=True)
        >>> format_eng(0)
        ' 0'
        >>> format_eng = EngFormatter(accuracy=1, use_eng_prefix=True)
        >>> format_eng(1_000_000)
        ' 1.0M'
        >>> format_eng = EngFormatter(accuracy=2, use_eng_prefix=False)
        >>> format_eng("-1e-6")
        '-1.00E-06'

        @param num: the value to represent
        @type num: either a numeric value or a string that can be converted to
                   a numeric value (as per decimal.Decimal constructor)

        @return: engineering formatted string
        rQ�infrgrrSr�zE-�02dzE+rz{mant: g}{prefix}z{mant: .r�z
f}{prefix})�mant�prefix)r
r��is_nan�is_infiniterj�mathrWrXrkr9�ENG_PREFIXESrr�r�r�)
rb�num�dnum�sign�pow10�	int_pow10r�r��
format_strr�s
          rc�__call__zEngFormatter.__call__Zs_��(�s�3�x� ���>�>�$������t�$�����!�8��D��5�D��1�9��C��
�
�4�:�:�<�!�+;� <�q� @�A�B�E��A�J�E��	�	�#�d�/�/�4�4�6�7�8���	�	�#�d�/�/�4�4�6�7�8����J�	�����&�&�y�1�F�
��]��9�*�S�)�*�F��)�C��)�F��d�{�b�%�i�(���=�=� �,�J�$�T�]�]�1�$5�]�C�J��%�%�4��%�?�	��rer�)r�r�r�r�r�r�)r��floatr�r�)r�r�r�r�r�rdr�r�rercr�r�8s������S���S��	�S��	�S�	�
	�S��	�C�
�	�C��	�C��	
�2��	
�3��	
�3��	
�3��	�C��	�C��	�C�� 	�C�!�"	�C�#�L�*CH�-�"�-�;?�-�	
�-�;rer�c�0�tdt||��y)a
    Format float representation in DataFrame with SI notation.

    Parameters
    ----------
    accuracy : int, default 3
        Number of decimal digits after the floating point.
    use_eng_prefix : bool, default False
        Whether to represent a value with SI prefixes.

    Returns
    -------
    None

    Examples
    --------
    >>> df = pd.DataFrame([1e-9, 1e-3, 1, 1e3, 1e6])
    >>> df
                  0
    0  1.000000e-09
    1  1.000000e-03
    2  1.000000e+00
    3  1.000000e+03
    4  1.000000e+06

    >>> pd.set_eng_float_format(accuracy=1)
    >>> df
             0
    0  1.0E-09
    1  1.0E-03
    2  1.0E+00
    3  1.0E+03
    4  1.0E+06

    >>> pd.set_eng_float_format(use_eng_prefix=True)
    >>> df
            0
    0  1.000n
    1  1.000m
    2   1.000
    3  1.000k
    4  1.000M

    >>> pd.set_eng_float_format(accuracy=1, use_eng_prefix=True)
    >>> df
          0
    0  1.0n
    1  1.0m
    2   1.0
    3  1.0k
    4  1.0M

    >>> pd.set_option("display.float_format", None)  # unset option
    r\N)rr�r�s  rc�set_eng_float_formatr��s��n�%�|�H�n�'M�Nrec��t|�dk(rgSdgt|d�z}g}|D]U}d}i}t|�D]\}}||r||k(r�d||<||z
||<|}�!t|�|z
||<|j|��W|S)a�
    For each index in each level the function returns lengths of indexes.

    Parameters
    ----------
    levels : list of lists
        List of values on for level.
    sentinel : string, optional
        Value which states that no new index starts on there.

    Returns
    -------
    Returns list of maps. For each level returns map of indexes (key is index
    in row and value is length of index).
    rTF)rir3r7)	rU�sentinel�controlr�rJ�
last_index�lengthsr:�keys	         rc�get_level_lengthsr��s���$�6�{�a���	��f�s�6�!�9�~�%�G�
�F����
�����&�F�A�s��q�z�c�X�o��"���
�&'�*�n��
�#��
�
'�"�%�j�:�5��
���
�
�g��� �Mrec��td�|D��r|D�cgc]
}t|���}}|jdj|��ycc}w)z�
    Appends lines to a buffer.

    Parameters
    ----------
    buf
        The buffer to write to
    lines
        The lines to append.
    c3�<K�|]}t|t����y�wr�)ryr�rs  rcr0z#buffer_put_lines.<locals>.<genexpr>s����
-�u�!�:�a���u�s�rvN)rTr�r�r�)r^�linesr/s   rc�buffer_put_linesr��sD���
-�u�
-�-�!&�'��A��Q����'��I�I�d�i�i�����(s�A)r�zdict[str, Any]r))r�r�r^r�r}r�r�r�r�)r^r�r}r�r�zIGenerator[WriteBuffer[str], None, None] | Generator[StringIO, None, None])	NrQNNrFrgTNN)r�r6rDrprWrkrUr�r�r�rBzstr | int | NonerHr�r�r�r�rlr�r�r�rpr�r�)rK�np.ndarray | Sequence[float]r�r�)r�r�r�rjro)r/�NaTType | Timestampr5r�r�r�r9)r/r�r5r�r�r�r�r�)rdr�r5r�r�r�r�r)rF)r�r)r5zstr | floatrmr�r�r)rFNN)
r)r�rHr�r*r�r`zprinting._TextAdjustment | Noner�r�)rg)r�r6r�r�r�r�)r�r�r�r�)r�r�r�r�r�r�)rTr,r�r�)r�F)r�rjr�r�r�r�)rr)rUrr�zbool | object | strr�zlist[dict[int, int]])r^zWriteBuffer[str]r�r�r�r�)�r��
__future__r�collections.abcrrrr�
contextlibr�csvr	r�r
�	functoolsr�iorr�r��shutilr
�typingrrrrr�numpyr#�pandas._config.configrr�pandas._libsr�pandas._libs.missingr�pandas._libs.tslibsrrr�pandas._libs.tslibs.nattyper�pandas.core.dtypes.commonrrrrrr �pandas.core.dtypes.dtypesr!r"r#�pandas.core.dtypes.missingr$r%�pandas.core.arraysr&r'r(r)�pandas.core.arrays.string_r*�pandas.core.baser+�pandas.core.common�core�commonr��pandas.core.indexes.apir,r-r.r/�pandas.core.indexes.datetimesr0�pandas.core.indexes.timedeltasr1�pandas.core.reshape.concatr2�pandas.io.commonr3r4r�r5�pandas._typingr6r7r8r9r:r;r<r=r>r?r@rA�pandasrBrCrDr;�VALID_JUSTIFY_PARAMETERSrNrPr�r�r�rsrr�r�r�r�r�r�r�rQrEr\r`rer�r�rnr5rr�rr�r�r�r�r�r�rerc�<module>r�s����#���&������	�$�����
�#���
0�����
�
��3�)� � ���8�9�-��'��
�
�
�
��6��%�6�p����%��_$�_$�D�B�>B�B�JZ�Z�~/3��
��
�	+�
��
��	
� �DH�M�	+�M�7A�M�N�M��M�P,0���"���!%��*.�R ��R ��R �)�R �
�	R �

�R ��
R ��R ��R ��R ��R �(�R ��R �jk�k�\F0�0�F0�R�/��#�1�#�6�5��B<"�.�<"��<"�~���"����
����	�	� JN�@��@�"%�@�<F�@�
�@��1��3�2�3�,!�����
��
���	�H��+/�	�
��
����
)�	�
��D�B	�7:�!�%�!�03�!��!�H&�]�]�@7O�v24�(��(�.�(��(�V
 re

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists