
    Pi                      d dl mZ d dlmZmZmZmZmZ d dlZd dl	m
Z
 d dlmZ d dlZd dlmZmZmZmZmZmZmZmZmZmZ d dlZd dlZd dlmZ d dlmZ d d	lm Z m!Z! d d
l"m#Z# d dl$m%Z% d dl&m'Z' d dl(m)Z) d dl*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0 d dl1m2Z2 d dl3m4Z4 d dl5m6Z6m7Z7m8Z8m9Z9 d dl:m;Z;m<Z<m=Z=m>Z>m?Z? d dl@mAZA d dlBmCZC erd dlDmEZE d dlFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOmPZP e	 d`dddddddddddddddddddddddddadE            ZQedddddddddddddddddddddddddbdH            ZQ e%dI          	 dcd ddddddddddddJdJdKdKdddLdd dejR        ddMdddS            ZQ edT          ZS G dU dVeeS                   ZT e%dI           G dW dXeeS                               ZUdYZVdZZW eX eYeZg eVeWR                     Z[	 dedfd]Z\ e%dI           G d^ d_                      Z]dS )g    )annotations)CallableHashableIterableMappingSequenceN)Decimal)partial)
IOTYPE_CHECKINGAnyGenericLiteralSelfTypeVarUnioncastoverload)config)lib)get_versionimport_optional_dependency)EmptyDataError)
set_module)find_stack_level)check_dtype_backend)is_bool
is_decimalis_file_likeis_float
is_integeris_list_like)	DataFrame)Version)	IOHandles
get_handlestringify_pathvalidate_header_arg)fill_mi_headerget_default_engine
get_writermaybe_convert_usecolspop_header_name)
TextParser)validate_integer)TracebackType)
DtypeArgDtypeBackendExcelWriterIfSheetExistsFilePath	HashableTIntStrT
ReadBufferSequenceNotStrStorageOptionsWriteExcelBuffer.)headernames	index_colusecolsdtypeengine
converterstrue_valuesfalse_valuesskiprowsnrows	na_valueskeep_default_na	na_filterverboseparse_datesdate_format	thousandsdecimalcomment
skipfooterstorage_optionsdtype_backend
sheet_name	str | intr;   int | Sequence[int] | Noner<   'SequenceNotStr[Hashable] | range | Noner=    int | str | Sequence[int] | Noner>   Nint | str | Sequence[int] | Sequence[str] | Callable[[HashableT], bool] | Noner?   DtypeArg | Noner@   ?Literal['xlrd', 'openpyxl', 'odf', 'pyxlsb', 'calamine'] | NonerA   0dict[str, Callable] | dict[int, Callable] | NonerB   Iterable[Hashable] | NonerC   rD   4Sequence[int] | int | Callable[[int], object] | NonerE   
int | NonerG   boolrH   rI   rJ   list | dict | boolrK    dict[Hashable, str] | str | NonerL   
str | NonerM   strrN   rO   intrP   r9   rQ   DtypeBackend | lib.NoDefaultreturnr#   c                   d S N iorR   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   s                            i/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/pandas/io/excel/_base.py
read_excelrl   X   s
    D     list[IntStrT] | Nonedict[IntStrT, DataFrame]c                   d S rg   rh   ri   s                            rk   rl   rl   }   s
    D  #srm   pandasTF.)r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   engine_kwargs str | int | list[IntStrT] | NoneStorageOptions | Noners   dict | None$DataFrame | dict[IntStrT, DataFrame]c               |   t          |           d}|i }t          | t                    sd}t          | |||          } n|r|| j        k    rt	          d          	 |                     ||||||||	|
|||||||||||||          }|r|                                  n# |r|                                  w w xY w|S )a13  
    Read an Excel file into a ``DataFrame``.

    Supports `xls`, `xlsx`, `xlsm`, `xlsb`, `odf`, `ods` and `odt` file extensions
    read from a local filesystem or URL. Supports an option to read
    a single sheet or a list of sheets.

    Parameters
    ----------
    io : str, ExcelFile, xlrd.Book, path object, or file-like object
        Any valid string path is acceptable. The string could be a URL. Valid
        URL schemes include http, ftp, s3, and file. For file URLs, a host is
        expected. A local file could be: ``file://localhost/path/to/table.xlsx``.

        If you want to pass in a path object, pandas accepts any ``os.PathLike``.

        By file-like object, we refer to objects with a ``read()`` method,
        such as a file handle (e.g. via builtin ``open`` function)
        or ``StringIO``.

    sheet_name : str, int, list, or None, default 0
        Strings are used for sheet names. Integers are used in zero-indexed
        sheet positions (chart sheets do not count as a sheet position).
        Lists of strings/integers are used to request multiple sheets.
        When ``None``, will return a dictionary containing DataFrames for each sheet.

        Available cases:

        * Defaults to ``0``: 1st sheet as a `DataFrame`
        * ``1``: 2nd sheet as a `DataFrame`
        * ``"Sheet1"``: Load sheet with name "Sheet1"
        * ``[0, 1, "Sheet5"]``: Load first, second and sheet named "Sheet5"
          as a dict of `DataFrame`
        * ``None``: Returns a dictionary containing DataFrames for each sheet.

    header : int, list of int, default 0
        Row (0-indexed) to use for the column labels of the parsed
        DataFrame. If a list of integers is passed those row positions will
        be combined into a ``MultiIndex``. Use None if there is no header.
    names : array-like, default None
        List of column names to use. If file contains no header row,
        then you should explicitly pass header=None.
    index_col : int, str, list of int, default None
        Column (0-indexed) to use as the row labels of the DataFrame.
        Pass None if there is no such column.  If a list is passed,
        those columns will be combined into a ``MultiIndex``.  If a
        subset of data is selected with ``usecols``, index_col
        is based on the subset.

        Missing values will be forward filled to allow roundtripping with
        ``to_excel`` for ``merged_cells=True``. To avoid forward filling the
        missing values use ``set_index`` after reading the data instead of
        ``index_col``.
    usecols : str, list-like, or callable, default None
        * If None, then parse all columns.
        * If str, then indicates comma separated list of Excel column letters
          and column ranges (e.g. "A:E" or "A,C,E:F"). Ranges are inclusive of
          both sides.
        * If list of int, then indicates list of column numbers to be parsed
          (0-indexed).
        * If list of string, then indicates list of column names to be parsed.
        * If callable, then evaluate each column name against it and parse the
          column if the callable returns ``True``.

        Returns a subset of the columns according to behavior above.
    dtype : Type name or dict of column -> type, default None
        Data type for data or columns. E.g. {'a': np.float64, 'b': np.int32}
        Use ``object`` to preserve data as stored in Excel and not interpret dtype,
        which will necessarily result in ``object`` dtype.
        If converters are specified, they will be applied INSTEAD
        of dtype conversion.
        If you use ``None``, it will infer the dtype of each column based on the data.
    engine : {'openpyxl', 'calamine', 'odf', 'pyxlsb', 'xlrd'}, default None
        If io is not a buffer or path, this must be set to identify io.
        Engine compatibility :

        - ``openpyxl`` supports newer Excel file formats.
        - ``calamine`` supports Excel (.xls, .xlsx, .xlsm, .xlsb)
          and OpenDocument (.ods) file formats.
        - ``odf`` supports OpenDocument file formats (.odf, .ods, .odt).
        - ``pyxlsb`` supports Binary Excel files.
        - ``xlrd`` supports old-style Excel files (.xls).

        When ``engine=None``, the following logic will be used to determine the engine:

        - If ``path_or_buffer`` is an OpenDocument format (.odf, .ods, .odt),
          then `odf <https://pypi.org/project/odfpy/>`_ will be used.
        - Otherwise if ``path_or_buffer`` is an xls format, ``xlrd`` will be used.
        - Otherwise if ``path_or_buffer`` is in xlsb format, ``pyxlsb`` will be used.
        - Otherwise ``openpyxl`` will be used.

    converters : dict, default None
        Dict of functions for converting values in certain columns. Keys can
        either be integers or column labels, values are functions that take one
        input argument, the Excel cell content, and return the transformed
        content.
    true_values : list, default None
        Values to consider as True.
    false_values : list, default None
        Values to consider as False.
    skiprows : list-like, int, or callable, optional
        Line numbers to skip (0-indexed) or number of lines to skip (int) at the
        start of the file. If callable, the callable function will be evaluated
        against the row indices, returning True if the row should be skipped and
        False otherwise. An example of a valid callable argument would be ``lambda
        x: x in [0, 2]``.
    nrows : int, default None
        Number of rows to parse. Does not include header rows.
    na_values : scalar, str, list-like, or dict, default None
        Additional strings to recognize as NA/NaN. If dict passed, specific
        per-column NA values. By default the following values are interpreted
        as NaN: '', '#N/A', '#N/A N/A', '#NA', '-1.#IND', '-1.#QNAN', '-NaN', '-nan',
        '1.#IND', '1.#QNAN', '<NA>', 'N/A', 'NA', 'NULL', 'NaN', 'None',
        'n/a', 'nan', 'null'.
    keep_default_na : bool, default True
        Whether or not to include the default NaN values when parsing the data.
        Depending on whether ``na_values`` is passed in, the behavior is as follows:

        * If ``keep_default_na`` is True, and ``na_values`` are specified,
          ``na_values`` is appended to the default NaN values used for parsing.
        * If ``keep_default_na`` is True, and ``na_values`` are not specified, only
          the default NaN values are used for parsing.
        * If ``keep_default_na`` is False, and ``na_values`` are specified, only
          the NaN values specified ``na_values`` are used for parsing.
        * If ``keep_default_na`` is False, and ``na_values`` are not specified, no
          strings will be parsed as NaN.

        Note that if `na_filter` is passed in as False, the ``keep_default_na`` and
        ``na_values`` parameters will be ignored.
    na_filter : bool, default True
        Detect missing value markers (empty strings and the value of na_values). In
        data without any NAs, passing ``na_filter=False`` can improve the
        performance of reading a large file.
    verbose : bool, default False
        Indicate number of NA values placed in non-numeric columns.
    parse_dates : bool, list-like, or dict, default False
        The behavior is as follows:

        * ``bool``. If True -> try parsing the index.
        * ``list`` of int or names. e.g. If [1, 2, 3] -> try parsing columns 1, 2, 3
          each as a separate date column.
        * ``list`` of lists. e.g.  If [[1, 3]] -> combine columns 1 and 3 and parse as
          a single date column.
        * ``dict``, e.g. {'foo' : [1, 3]} -> parse columns 1, 3 as date and call
          result 'foo'

        If a column or index contains an unparsable date, the entire column or
        index will be returned unaltered as an object data type. If you don`t want to
        parse some cells as date just change their type in Excel to "Text".
        For non-standard datetime parsing, use ``pd.to_datetime`` after
        ``pd.read_excel``.

        Note: A fast-path exists for iso8601-formatted dates.
    date_format : str or dict of column -> format, default ``None``
        If used in conjunction with ``parse_dates``, will parse dates according to this
        format. For anything more complex,
        please read in as ``object`` and then apply :func:`to_datetime` as-needed.

        .. versionadded:: 2.0.0

    thousands : str, default None
        Thousands separator for parsing string columns to numeric.  Note that
        this parameter is only necessary for columns stored as TEXT in Excel,
        any numeric columns will automatically be parsed, regardless of display
        format.
    decimal : str, default '.'
        Character to recognize as decimal point for parsing string columns to numeric.
        Note that this parameter is only necessary for columns stored as TEXT in Excel,
        any numeric columns will automatically be parsed, regardless of display
        format.(e.g. use ',' for European data).
    comment : str, default None
        Comments out remainder of line. Pass a character or characters to this
        argument to indicate comments in the input file. Any data between the
        comment string and the end of the current line is ignored.
    skipfooter : int, default 0
        Rows at the end to skip (0-indexed).
    storage_options : dict, optional
        Extra options that make sense for a particular storage connection, e.g.
        host, port, username, password, etc. For HTTP(S) URLs the key-value pairs
        are forwarded to ``urllib.request.Request`` as header options. For other
        URLs (e.g. starting with "s3://", and "gcs://") the key-value pairs are
        forwarded to ``fsspec.open``. Please see ``fsspec`` and ``urllib`` for more
        details, and for more examples on storage options refer `here
        <https://pandas.pydata.org/docs/user_guide/io.html?
        highlight=storage_options#reading-writing-remote-files>`_.

    dtype_backend : {'numpy_nullable', 'pyarrow'}
        Back-end data type applied to the resultant :class:`DataFrame`
        (still experimental). If not specified, the default behavior
        is to not use nullable data types. If specified, the behavior
        is as follows:

        * ``"numpy_nullable"``: returns nullable-dtype-backed :class:`DataFrame`
        * ``"pyarrow"``: returns pyarrow-backed nullable

        :class:`ArrowDtype` :class:`DataFrame`

        .. versionadded:: 2.0

    engine_kwargs : dict, optional
        Arbitrary keyword arguments passed to excel engine.

    Returns
    -------
    DataFrame or dict of DataFrames
        DataFrame from the passed in Excel file. See notes in sheet_name
        argument for more information on when a dict of DataFrames is returned.

    See Also
    --------
    DataFrame.to_excel : Write DataFrame to an Excel file.
    DataFrame.to_csv : Write DataFrame to a comma-separated values (csv) file.
    read_csv : Read a comma-separated values (csv) file into DataFrame.
    read_fwf : Read a table of fixed-width formatted lines into DataFrame.

    Notes
    -----
    For specific information on the methods used for each Excel engine, refer to the
    pandas
    :ref:`user guide <io.excel_reader>`

    Examples
    --------
    The file can be read using the file name as string or an open file object:

    >>> pd.read_excel("tmp.xlsx", index_col=0)  # doctest: +SKIP
           Name  Value
    0   string1      1
    1   string2      2
    2  #Comment      3

    >>> pd.read_excel(open("tmp.xlsx", "rb"), sheet_name="Sheet3")  # doctest: +SKIP
       Unnamed: 0      Name  Value
    0           0   string1      1
    1           1   string2      2
    2           2  #Comment      3

    Index and header can be specified via the `index_col` and `header` arguments

    >>> pd.read_excel("tmp.xlsx", index_col=None, header=None)  # doctest: +SKIP
         0         1      2
    0  NaN      Name  Value
    1  0.0   string1      1
    2  1.0   string2      2
    3  2.0  #Comment      3

    Column types are inferred but can be explicitly specified

    >>> pd.read_excel(
    ...     "tmp.xlsx", index_col=0, dtype={"Name": str, "Value": float}
    ... )  # doctest: +SKIP
           Name  Value
    0   string1    1.0
    1   string2    2.0
    2  #Comment    3.0

    True, False, and NA values, and thousands separators have defaults,
    but can be explicitly specified, too. Supply the values you would like
    as strings or lists of strings!

    >>> pd.read_excel(
    ...     "tmp.xlsx", index_col=0, na_values=["string1", "string2"]
    ... )  # doctest: +SKIP
           Name  Value
    0       NaN      1
    1       NaN      2
    2  #Comment      3

    Comment lines in the excel input file can be skipped using the
    ``comment`` kwarg.

    >>> pd.read_excel("tmp.xlsx", index_col=0, comment="#")  # doctest: +SKIP
          Name  Value
    0  string1    1.0
    1  string2    2.0
    2     None    NaN
    FNT)rP   r@   rs   z_Engine should not be specified when passing an ExcelFile - ExcelFile already has the engine set)rR   r;   r<   r=   r>   r?   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rQ   )r   
isinstance	ExcelFiler@   
ValueErrorparseclose)rj   rR   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rs   should_closedatas                               rk   rl   rl      s(   p	 &&&Lb)$$ 
+'	
 
 
 
 
Fbi''B
 
 	

xx!!#%+##!'-  
 
4  	HHJJJ  	HHJJJJ	Ks   +B   B9
_WorkbookTc                     e Zd ZU ded<   	 	 dGdHd
ZedId            ZdJdZdKdZedLd            Z	dMdZ
dNdZdOdPdZdQdZdRdZdSdZdTd%Zd&d&dddddddddd'd'ddd(dd&ej        fdUd?Zdd&dddddddddd'ddd(dd&ej        fdVdFZdS )WBaseExcelReaderr   bookNrP   ru   rs   rv   re   Nonec                ,   |i }t          |dd i          | _        t          |t          | j        f          st          |d|d          | _        t          | j        j        | j                  r| j        j        | _        d S t          | j        j        d          rj| j        j        	                    d           	 | 
                    | j        j        |          | _        d S # t          $ r |                                   w xY wt          d          )	Nmethod)handlecompressionrbFrP   is_textreadr   zCMust explicitly set engine if not passing in buffer or path for io.)r%   handlesry   rz   _workbook_classr&   r   r   hasattrseekload_workbook	Exceptionr}   r{   )selffilepath_or_bufferrP   rs   s       rk   __init__zBaseExcelReader.__init__  s/     M %Hd3C
 
 
 ,y$:N.OPP 	%"D/SX  DL dl)4+?@@ 	+DIIIT\(&11 	L$$Q''' ..t|/BMRR			   

 U  s   =%C$ $ Dtype[_WorkbookT]c                    t           rg   NotImplementedErrorr   s    rk   r   zBaseExcelReader._workbook_class3      !!rm   c                    t           rg   r   )r   r   rs   s      rk   r   zBaseExcelReader.load_workbook7      !!rm   c                   t          | d          r]t          | j        d          r| j                                         n.t          | j        d          r| j                                         | j                                         d S )Nr   r}   release_resources)r   r   r}   r   r   r   s    rk   r}   zBaseExcelReader.close:  s    4   		.ty'** . 	!!!!$788 . 	++---rm   	list[str]c                    t           rg   r   r   s    rk   sheet_nameszBaseExcelReader.sheet_namesG  r   rm   namerb   c                    t           rg   r   r   r   s     rk   get_sheet_by_namez!BaseExcelReader.get_sheet_by_nameK  r   rm   indexrc   c                    t           rg   r   )r   r   s     rk   get_sheet_by_indexz"BaseExcelReader.get_sheet_by_indexN  r   rm   rowsr]   c                    t           rg   r   )r   sheetr   s      rk   get_sheet_datazBaseExcelReader.get_sheet_dataQ  r   rm   c                f    t          | j                  }||k    rt          d| d| d          d S )NzWorksheet index z is invalid, z worksheets found)lenr   r{   )r   r   n_sheetss      rk   raise_if_bad_sheet_by_indexz+BaseExcelReader.raise_if_bad_sheet_by_indexT  sM    t'((HR5RRxRRR   rm   c                >    || j         vrt          d| d          d S )NzWorksheet named 'z' not found)r   r{   r   s     rk   raise_if_bad_sheet_by_namez*BaseExcelReader.raise_if_bad_sheet_by_name[  s2    t'''BBBBCCC ('rm   rD   r   rows_to_usec                P    d}d}||k     r ||          s|dz  }|dz  }||k     |S )a  
        Determine how many file rows are required to obtain `nrows` data
        rows when `skiprows` is a function.

        Parameters
        ----------
        skiprows : function
            The function passed to read_excel by the user.
        rows_to_use : int
            The number of rows that will be needed for the header and
            the data.

        Returns
        -------
        int
        r      rh   )r   rD   r   irows_used_so_fars        rk   _check_skiprows_funcz$BaseExcelReader._check_skiprows_func_  sR    * ,,8A;; & A% FA ,, rm   r;   rT   r=   r\   rE   c                |   |dS |d}nJt          |          rt          t          |          }d|z   }n t          t          |          }d|d         z   }t	          |          r/|-t          t          |          }t          |          dk    r|dz  }|||z   S t          |          rt          t          |          }||z   |z   S t	          |          r@dd
}t          t          |          }|                     t          ||          ||z             S t          |          r|                     |||z             S dS )a  
        If nrows specified, find the number of rows needed from the
        file, otherwise return None.


        Parameters
        ----------
        header : int, list of int, or None
            See read_excel docstring.
        index_col : int, str, list of int, or None
            See read_excel docstring.
        skiprows : list-like, int, callable, or None
            See read_excel docstring.
        nrows : int or None
            See read_excel docstring.

        Returns
        -------
        int or None
        Nr   rD   r   xrc   re   r^   c                
    || v S rg   rh   )rD   r   s     rk   fz%BaseExcelReader._calc_rows.<locals>.f  s    H}$rm   )rD   r   r   rc   re   r^   )	r!   r   rc   r   r"   r   r   r
   callable)r   r;   r=   rD   rE   header_rowsr   s          rk   
_calc_rowszBaseExcelReader._calc_rows|  su   6 =4>KK 	)#v&&Ff*KK(F++FfRj.K  	!I$9(F++F6{{Qq &&h 	2C**H&11!! 	X% % % % Hh//H,,WQ-A-A;QVCVWWWH 	,,e#   trm   r   Frr   rR   (str | int | list[int] | list[str] | Noner<   rU   r?   rX   rB   r[   rC   rI   r^   rJ   r_   rK   r`   rL   ra   rM   rN   rO   rQ   rd   c                (   t          |           t          d|
           d}t          |t                    r|}d}n(|
| j        }d}nt          |t
                    r|g}n|g}t          t          t          t                   t          t
                   f         t          t          
                    |                                                              }i }d }|D ]}|}|rt          d|            t          |t
                    r|                     |          }n|                     |          }|                     |||	|
          }|                     ||          }t#          |d          r|                                 t'          |          }|st)                      ||<    | j        di d|d|d|d	|d
|d|d|d|d|	d|
d|d|d|d|d|d|d|d|d|d||}|t-          d          |r|S ||         S )NrE   FTzReading sheet r}   r   output
asheetnamer;   r<   r=   r>   r?   rD   rB   rC   rF   rJ   rK   rL   rM   rN   rO   rQ   zSheet name is an empty listrh   )r(   r/   ry   listr   rb   r   r   rc   dictfromkeyskeysprintr   r   r   r   r   r}   r,   r#   _parse_sheetr{   )r   rR   r;   r<   r=   r>   r?   rB   rC   rD   rE   rF   rI   rJ   rK   rL   rM   rN   rO   rQ   kwdsret_dictsheetsr   last_sheetnamer   r   file_rows_neededr   s                                rk   r|   zBaseExcelReader.parse  s   . 	F###%((( j$'' 		"FHH%FHH
C(( 	" \FF \F eDItCy014f8M8M8R8R8T8T3U3UVV  +	 +	J'N 53z33444*c** <..z:://
;;#vy(ERR&&u.>??Dug&& +G44G %.[[z"&T&   Tv &: v	
 e $)   e " e (K *\ $) (K (K  $)!"  #$  %& &:'( ,m+ FF0 !:;;; 	*M.))rm   r   r   r   r   r   str | int | Nonec           	       #$ d}d}t          |          r.t          |t                    sJ d}t          |          dk    rd}|r&t	          t          t
                   |          d         }d }|t          |          rt          |t                    sJ g }dgt          |d                   z  #|D ]}t          |	          rt          |	t
                    sJ ||	z  }|t          |          dz
  k    r&t          d| dt          |          dz
   d          t          ||         #          \  ||<   #|.t          ||         |          \  }}|
                    |           d}|r|s|t          |t
                    r|h$n&t          |t                    sJ t          |          $t          |t                    sJ t          |          t          |          k     r>|t          |                   }t          #$fdt          |          D                       }t          |          r|d}n-t          |t
                    rd|z   }ndt          |          z   }|r|dz  }|t          |          k     rt          |t                    sJ |D ]m}||         |         } t          |dz   t          |                    D ]<}||         |         d	k    s||         |         | ||         |<   .||         |         } =n	 t!          |fi d
|d|d|d|d|d|d|d|	d|
d|ddd|d|d|d|d|d|d|d||}!|!                    |
          ||<   |r+||         j                            |          ||         _        nY# t(          $ r t+                      ||<   Y n<t,          $ r0}"|"j        d          d| dg|"j        dd          R |"_        |"d }"~"ww xY w|S ) NFTr   r   zheader index z exceeds maximum index z	 of data.c              3  J   K   | ]\  }}|         s|v|d k    p|du V  dS ) Nrh   ).0r   r   control_rowindex_col_sets      rk   	<genexpr>z/BaseExcelReader._parse_sheet.<locals>.<genexpr>l  sY       & &1&q>& /0}.D.D G(qDy.D.D.D.D& &rm   r   r<   r;   r=   has_index_namesr?   rB   rC   rD   rE   rF   skip_blank_linesrJ   rK   rL   rM   rN   rO   r>   rQ   )rE   z	 (sheet: ))r"   ry   r   r   r   rc   r!   r{   r)   r-   appendsetall	enumeratemaxranger.   r   columns	set_namesr   r#   r   args)%r   r   r   r   r;   r<   r=   r>   r?   rD   rE   rB   rC   rF   rJ   rK   rL   rM   rN   rO   rQ   r   is_list_headeris_len_one_list_headerheader_namesrowheader_name_r   potential_index_namesoffsetcollastparsererrr   r   s%                                      @@rk   r   zBaseExcelReader._parse_sheet   s[   0 !& 	.fh/////!N6{{a)-&! 	4(3-003F ,v"6"6fh/////L&3tAw<</K 5 5h'' $%h444448OCTQ&&$4 4 4t99q=4 4 4  
 *8S	;)O)O&S	;(%4T#Y	%J%JNK ''444   	"8 	Y=R)S)) /!*!)X66666 #I fh/////6{{SYY&&(,S[[(9%"% & & & & & )*? @ @& & & # # 	"" 	2~FC(( )VS[[
  ! D		!!!)X66666$ 2 2C<,D$VaZT;; 2 29S>R//49S>3I-1DIcNN#'9S>DD	2&	  e v $)	
 !0 e (K *\ " e $) "' (K (K $)   !"  #$ &:%&  '( ,m+ F0 "(5!9!9F: -3J-?-G-Q-Q . .z"*  	- 	- 	-!*F: 	 	 	8A;>>>>>N!""NNCHI	 s   BN O+2	O+;+O&&O+)NN)rP   ru   rs   rv   re   r   )re   r   re   r   re   r   )re   r   )r   rb   )r   rc   rg   )r   r]   )r   rc   re   r   )r   rb   re   r   )rD   r   r   rc   re   rc   )
r;   rT   r=   rT   rD   r\   rE   r]   re   r]   )"rR   r   r;   rT   r<   rU   r=   rT   r?   rX   rB   r[   rC   r[   rD   r\   rE   r]   rI   r^   rJ   r_   rK   r`   rL   ra   rM   rb   rN   ra   rO   rc   rQ   rd   )$r   r   r   r   r   r   r;   rT   r<   rU   r=   rT   r?   rX   rD   r\   rE   r]   rB   r[   rC   r[   rJ   r_   rK   r`   rL   ra   rM   rb   rN   ra   rO   rc   rQ   rd   )__name__
__module____qualname____annotations__r   propertyr   r   r}   r   r   r   r   r   r   r   r   r   
no_defaultr|   r   rh   rm   rk   r   r     s        
 26%)	    @ " " " X"" " " "    " " " X"" " " "" " " "" " " " "   D D D D   :> > > >D @A-.9=04!%1526IM */8< $"69n)b* b* b* b* b*P (,-.9=04!%IM 1526*/8< $"69n+X X X X X X Xrm   r   c                  d   e Zd ZU dZded<   ded<   	 	 	 	 	 	 	 d>d?dZed@d            ZedAd            ZedBd            Z	edCd            Z
	 	 	 	 	 dDdEd'ZdFd(Z	 	 	 	 	 	 	 d>dGd*ZedAd+            ZedAd,            ZedAd-            ZdAd.ZdHd/ZdId1ZedJd4            ZdKd5ZdLd<ZdFd=ZdS )MExcelWritera  
    Class for writing DataFrame objects into excel sheets.

    Default is to use:

    * `xlsxwriter <https://pypi.org/project/XlsxWriter/>`__ for xlsx files if xlsxwriter
      is installed otherwise `openpyxl <https://pypi.org/project/openpyxl/>`__
    * `odf <https://pypi.org/project/odfpy/>`__ for ods files

    See :meth:`DataFrame.to_excel` for typical usage.

    The writer should be used as a context manager. Otherwise, call `close()` to save
    and close any opened file handles.

    Parameters
    ----------
    path : str or typing.BinaryIO
        Path to xls or xlsx or ods file.
    engine : str (optional)
        Engine to use for writing. If None, defaults to
        ``io.excel.<extension>.writer``.  NOTE: can only be passed as a keyword
        argument.
    date_format : str, default None
        Format string for dates written into Excel files (e.g. 'YYYY-MM-DD').
    datetime_format : str, default None
        Format string for datetime objects written into Excel files.
        (e.g. 'YYYY-MM-DD HH:MM:SS').
    mode : {{'w', 'a'}}, default 'w'
        File mode to use (write or append). Append does not work with fsspec URLs.
    storage_options : dict, optional
        Extra options that make sense for a particular storage connection, e.g.
        host, port, username, password, etc. For HTTP(S) URLs the key-value pairs
        are forwarded to ``urllib.request.Request`` as header options. For other
        URLs (e.g. starting with "s3://", and "gcs://") the key-value pairs are
        forwarded to ``fsspec.open``. Please see ``fsspec`` and ``urllib`` for more
        details, and for more examples on storage options refer `here
        <https://pandas.pydata.org/docs/user_guide/io.html?
        highlight=storage_options#reading-writing-remote-files>`_.

    if_sheet_exists : {{'error', 'new', 'replace', 'overlay'}}, default 'error'
        How to behave when trying to write to a sheet that already
        exists (append mode only).

        * error: raise a ValueError.
        * new: Create a new sheet, with a name determined by the engine.
        * replace: Delete the contents of the sheet before writing to it.
        * overlay: Write contents to the existing sheet without first removing,
          but possibly over top of, the existing contents.

    engine_kwargs : dict, optional
        Keyword arguments to be passed into the engine. These will be passed to
        the following functions of the respective engines:

        * xlsxwriter: ``xlsxwriter.Workbook(file, **engine_kwargs)``
        * openpyxl (write mode): ``openpyxl.Workbook(**engine_kwargs)``
        * openpyxl (append mode): ``openpyxl.load_workbook(file, **engine_kwargs)``
        * odf: ``odf.opendocument.OpenDocumentSpreadsheet(**engine_kwargs)``

    See Also
    --------
    read_excel : Read an Excel sheet values (xlsx) file into DataFrame.
    read_csv : Read a comma-separated values (csv) file into DataFrame.
    read_fwf : Read a table of fixed-width formatted lines into DataFrame.

    Notes
    -----
    For compatibility with CSV writers, ExcelWriter serializes lists
    and dicts to strings before writing.

    Examples
    --------
    Default usage:

    >>> df = pd.DataFrame([["ABC", "XYZ"]], columns=["Foo", "Bar"])  # doctest: +SKIP
    >>> with pd.ExcelWriter("path_to_file.xlsx") as writer:
    ...     df.to_excel(writer)  # doctest: +SKIP

    To write to separate sheets in a single file:

    >>> df1 = pd.DataFrame([["AAA", "BBB"]], columns=["Spam", "Egg"])  # doctest: +SKIP
    >>> df2 = pd.DataFrame([["ABC", "XYZ"]], columns=["Foo", "Bar"])  # doctest: +SKIP
    >>> with pd.ExcelWriter("path_to_file.xlsx") as writer:
    ...     df1.to_excel(writer, sheet_name="Sheet1")  # doctest: +SKIP
    ...     df2.to_excel(writer, sheet_name="Sheet2")  # doctest: +SKIP

    You can set the date format or datetime format:

    >>> from datetime import date, datetime  # doctest: +SKIP
    >>> df = pd.DataFrame(
    ...     [
    ...         [date(2014, 1, 31), date(1999, 9, 24)],
    ...         [datetime(1998, 5, 26, 23, 33, 4), datetime(2014, 2, 28, 13, 5, 13)],
    ...     ],
    ...     index=["Date", "Datetime"],
    ...     columns=["X", "Y"],
    ... )  # doctest: +SKIP
    >>> with pd.ExcelWriter(
    ...     "path_to_file.xlsx",
    ...     date_format="YYYY-MM-DD",
    ...     datetime_format="YYYY-MM-DD HH:MM:SS",
    ... ) as writer:
    ...     df.to_excel(writer)  # doctest: +SKIP

    You can also append to an existing Excel file:

    >>> with pd.ExcelWriter("path_to_file.xlsx", mode="a", engine="openpyxl") as writer:
    ...     df.to_excel(writer, sheet_name="Sheet3")  # doctest: +SKIP

    Here, the `if_sheet_exists` parameter can be set to replace a sheet if it
    already exists:

    >>> with pd.ExcelWriter(
    ...     "path_to_file.xlsx",
    ...     mode="a",
    ...     engine="openpyxl",
    ...     if_sheet_exists="replace",
    ... ) as writer:
    ...     df.to_excel(writer, sheet_name="Sheet1")  # doctest: +SKIP

    You can also write multiple DataFrames to a single sheet. Note that the
    ``if_sheet_exists`` parameter needs to be set to ``overlay``:

    >>> with pd.ExcelWriter(
    ...     "path_to_file.xlsx",
    ...     mode="a",
    ...     engine="openpyxl",
    ...     if_sheet_exists="overlay",
    ... ) as writer:
    ...     df1.to_excel(writer, sheet_name="Sheet1")
    ...     df2.to_excel(writer, sheet_name="Sheet1", startcol=3)  # doctest: +SKIP

    You can store Excel file in RAM:

    >>> import io
    >>> df = pd.DataFrame([["ABC", "XYZ"]], columns=["Foo", "Bar"])
    >>> buffer = io.BytesIO()
    >>> with pd.ExcelWriter(buffer) as writer:
    ...     df.to_excel(writer)

    You can pack Excel file into zip archive:

    >>> import zipfile  # doctest: +SKIP
    >>> df = pd.DataFrame([["ABC", "XYZ"]], columns=["Foo", "Bar"])  # doctest: +SKIP
    >>> with zipfile.ZipFile("path_to_file.zip", "w") as zf:
    ...     with zf.open("filename.xlsx", "w") as buffer:
    ...         with pd.ExcelWriter(buffer) as writer:
    ...             df.to_excel(writer)  # doctest: +SKIP

    You can specify additional arguments to the underlying engine:

    >>> with pd.ExcelWriter(
    ...     "path_to_file.xlsx",
    ...     engine="xlsxwriter",
    ...     engine_kwargs={{"options": {{"nan_inf_to_errors": True}}}},
    ... ) as writer:
    ...     df.to_excel(writer)  # doctest: +SKIP

    In append mode, ``engine_kwargs`` are passed through to
    openpyxl's ``load_workbook``:

    >>> with pd.ExcelWriter(
    ...     "path_to_file.xlsx",
    ...     engine="openpyxl",
    ...     mode="a",
    ...     engine_kwargs={{"keep_vba": True}},
    ... ) as writer:
    ...     df.to_excel(writer, sheet_name="Sheet2")  # doctest: +SKIP
    rb   _enginetuple[str, ...]_supported_extensionsNwpath)FilePath | WriteExcelBuffer | ExcelWriterr@   ra   rK   datetime_formatmoderP   ru   if_sheet_existsExcelWriterIfSheetExists | Noners   rv   re   r   c	                   | t           u r|t          |t                    r|dk    rt          |t                    r.t          j                            |          d         dd          }	nd}		 t          j        d|	 d          }|dk    rt          |	d          }n&# t          $ r}
t          d	|	 d
          |
d }
~
ww xY w|J t          |          } t                              |           S )Nautor   r   xlsx	io.excel.z.writerwriterr  zNo engine for filetype: '')r   ry   rb   osr   splitextr   
get_optionr*   KeyErrorr{   r+   object__new__)clsr   r@   rK   r  r  rP   r  rs   extr   s              rk   r  zExcelWriter.__new__  s    +~*VS"9"9~f>N>NdC(( !'**4004QRR8CC CR#./G3/G/G/GHHF''!3Ch!G!G!G R R R$%G%G%G%GHHcQR %%% V$$C~~c"""s   -/B 
C 'B;;C c                    | j         S )z'Extensions that writer engine supports.)r   r   s    rk   supported_extensionsz ExcelWriter.supported_extensions  s     ))rm   c                    | j         S )zName of engine.)r   r   s    rk   r@   zExcelWriter.engine  s     |rm   dict[str, Any]c                    t           )z(Mapping of sheet names to sheet objects.r   r   s    rk   r   zExcelWriter.sheets  s
     "!rm   r   c                    t           )z
        Book instance. Class type will depend on the engine used.

        This attribute can be used to access engine-specific features.
        r   r   s    rk   r   zExcelWriter.book  s
     "!rm   r   rR   startrowrc   startcolfreeze_panestuple[int, int] | Noneautofilter_ranger   c                    t           )a  
        Write given formatted cells into Excel an excel sheet

        Parameters
        ----------
        cells : generator
            cell of formatted data to save to Excel sheet
        sheet_name : str, default None
            Name of Excel sheet, if None, then use self.cur_sheet
        startrow : upper left cell row to dump data frame
        startcol : upper left cell column to dump data frame
        freeze_panes: int tuple of length 2
            contains the bottom-most row and right-most column to freeze
        autofilter_range: str, default None
            column ranges to add automatic filters to, for example "A1:D5"
        r   )r   cellsrR   r  r  r  r  s          rk   _write_cellszExcelWriter._write_cells  s
    2 "!rm   c                    t           )z(
        Save workbook to disk.
        r   r   s    rk   _savezExcelWriter._save  s
     "!rm   dict[str, Any] | Nonec	                v   t          |t                    r:t          j                            |          d         }	|                     |	           d|vr|dz  }|                    dd          }|dvrt          d| d          |rd|vrt          d          |d	}|| _        t          t          t          t                   |          d
d i          | _        t          |t                    st          |||d          | _        d | _        |d| _        n|| _        |d| _        n|| _        || _        d S )Nr   bazr+)Nerrornewreplaceoverlayr  z^' is not valid for if_sheet_exists. Valid options are 'error', 'new', 'replace' and 'overlay'.z7if_sheet_exists is only valid in append mode (mode='a')r(  r   )r   Fr   z
YYYY-MM-DDzYYYY-MM-DD HH:MM:SS)ry   rb   r  r   r  check_extensionr*  r{   _if_sheet_existsr%   r   r   bytes_handlesr   r&   
_cur_sheet_date_format_datetime_format_mode)
r   r   r@   rK   r  r  rP   r  rs   r  s
             rk   r   zExcelWriter.__init__  s    dC   	&'""4((,C  %%% d??CKD ||C&&"NNNMO M M M    	Xt4//VWWW"%O / "ED!!t/D
 
 
 $,, 	&dOU  DM  ,D +D"$9D!!$3D!


rm   c                    | j         S zW
        Format string for dates written into Excel files (e.g. 'YYYY-MM-DD').
        )r1  r   s    rk   rK   zExcelWriter.date_format  s    
   rm   c                    | j         S r5  )r2  r   s    rk   r  zExcelWriter.datetime_format      
 $$rm   c                    | j         S )z[
        How to behave when writing to a sheet that already exists in append mode.
        )r-  r   s    rk   r  zExcelWriter.if_sheet_exists  r7  rm   c                8    t          | j        j        dd          S )Nr   r   )getattrr/  r   r   s    rk   
__fspath__zExcelWriter.__fspath__&  s    t}+VR888rm   c                :    || j         }|t          d          |S )Nz8Must pass explicit sheet_name or set _cur_sheet property)r0  r{   )r   rR   s     rk   _get_sheet_namezExcelWriter._get_sheet_name)  s*    JWXXXrm   Otuple[int | float | bool | str | datetime.datetime | datetime.date, str | None]c                   d}t          |          rt          |          }n1t          |          rt          |          }nt	          |          rt          |          }nt          |          rt          |          }nt          |t          j	                  r| j
        }nt          |t          j                  r| j        }nt          |t          j                  r|                                dz  }d}n[t          |          }t!          |          dk    r9t#          j        dt!          |           dt&          t)                                 ||fS )aG  
        Convert numpy types to Python types for the Excel writers.

        Parameters
        ----------
        val : object
            Value to be written into cells

        Returns
        -------
        Tuple with the first element being the converted value and the second
            being an optional format
        NiQ 0i  zCell contents too long (z ), truncated to 32767 characters)
stacklevel)r!   rc   r    floatr   r^   r   r	   ry   datetimer2  dater1  	timedeltatotal_secondsrb   r   warningswarnUserWarningr   )r   valfmts      rk   _value_with_fmtzExcelWriter._value_with_fmt0  sN   $ c?? 	c((CCc]] 	**CCS\\ 	s))CC__ 	#,,CCX.// 	'CCX]++ 	#CCX/00 	##%%-CCCc((C 3xx%4s3xx 4 4 4/11	    Cxrm   r  Literal[True]c                                         d          r
dd         t          fd| j        D                       st          d| j         d d          dS )	z
        checks that path's extension against the Writer's supported
        extensions.  If it isn't supported, raises UnsupportedFiletypeError.
        rr   r   Nc              3      K   | ]}|v V  	d S rg   rh   )r   	extensionr  s     rk   r   z.ExcelWriter.check_extension.<locals>.<genexpr>i  s(      OO	3)#OOOOOOrm   zInvalid extension for engine 'z': 'r  T)
startswithanyr   r{   r@   )r  r  s    `rk   r,  zExcelWriter.check_extensiona  sx     >># 	abb'COOOOS5NOOOOO 	VTcjTTcTTTUUUtrm   c                    | S rg   rh   r   s    rk   	__enter__zExcelWriter.__enter__n      rm   exc_typetype[BaseException] | None	exc_valueBaseException | None	tracebackTracebackType | Nonec                .    |                                   d S rg   r}   r   rV  rX  rZ  s       rk   __exit__zExcelWriter.__exit__q       	

rm   c                `    |                                   | j                                         dS )z+synonym for save, to make it more file-likeN)r#  r/  r}   r   s    rk   r}   zExcelWriter.closey  s)    

rm   )NNNr   NNN)r   r   r@   ra   rK   ra   r  ra   r  rb   rP   ru   r  r  rs   rv   re   r   )re   r   )re   rb   )re   r  r   )Nr   r   NN)rR   ra   r  rc   r  rc   r  r  r  ra   re   r   r   )r   r   r@   ra   rK   ra   r  ra   r  rb   rP   ru   r  r  rs   r$  re   r   )rR   ra   re   rb   )re   r>  )r  rb   re   rM  re   r   rV  rW  rX  rY  rZ  r[  re   r   )r   r   r   __doc__r   r  r   r  r@   r   r   r!  r#  r   rK   r  r  r;  r=  rL  classmethodr,  rT  r_  r}   rh   rm   rk   r   r     sS        g g~ LLL****
 ""&&*15;?%) #  #  #  #  #D * * * X*    X " " " X" " " " X" "&/3'+" " " " "6" " " " ""&&*15;?/35 5 5 5 5n ! ! ! X! % % % X% % % % X%9 9 9 9   / / / /b 	 	 	 [	           rm   r   )s   	    s   	    s   	    s   ࡱs   PKcontent_or_pathFilePath | ReadBuffer[bytes]c                   t          | d|d          5 }|j        }|                    d           |                    t                    }|t          d          t          |t                    sJ ||                    d           t          fdt          D                       r	 ddd           dS 
                    t                    s	 ddd           dS t          j        |          5 }d	 |                                D             }ddd           n# 1 swxY w Y   d
|v r	 ddd           dS d|v r	 ddd           dS d|v r	 ddd           dS 	 ddd           dS # 1 swxY w Y   dS )a  
    Inspect the path or content of an excel file and get its format.

    Adopted from xlrd: https://github.com/python-excel/xlrd.

    Parameters
    ----------
    content_or_path : str or file-like object
        Path to file or content of file to inspect. May be a URL.
    storage_options : dict, optional
        Extra options that make sense for a particular storage connection, e.g.
        host, port, username, password, etc. For HTTP(S) URLs the key-value pairs
        are forwarded to ``urllib.request.Request`` as header options. For other
        URLs (e.g. starting with "s3://", and "gcs://") the key-value pairs are
        forwarded to ``fsspec.open``. Please see ``fsspec`` and ``urllib`` for more
        details, and for more examples on storage options refer `here
        <https://pandas.pydata.org/docs/user_guide/io.html?
        highlight=storage_options#reading-writing-remote-files>`_.

    Returns
    -------
    str or None
        Format of file if it can be determined.

    Raises
    ------
    ValueError
        If resulting stream is empty.
    BadZipFile
        If resulting stream does not have an XLS signature and is not a valid zipfile.
    r   Fr   r   Nzstream is emptyc              3  B   K   | ]}                     |          V  d S rg   )rQ  )r   sigpeeks     rk   r   z'inspect_excel_format.<locals>.<genexpr>  s/      >>ts##>>>>>>rm   xlsc                ^    h | ]*}|                     d d                                          +S )\/)r*  lower)r   r   s     rk   	<setcomp>z'inspect_excel_format.<locals>.<setcomp>  s?       48T3''--//  rm   zxl/workbook.xmlr  zxl/workbook.binxlsbzcontent.xmlodszip)r&   r   r   r   	PEEK_SIZEr{   ry   r.  rR  XLS_SIGNATURESrQ  ZIP_SIGNATUREzipfileZipFilenamelist)rf  rP   r   streambufzfcomponent_namesrk  s          @rk   inspect_excel_formatr    s   F 

 
 
 	Akk)$$;.///#u%%%%%A>>>>~>>>>> 	        // 	       " _V$$ 	 <>KKMM  O	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 //3       4 //7       8 O++;       < =                 sT   BE/9E/!E/5D E/ D$	$E/'D$	(E/=E/E/!E//E36E3c                      e Zd ZU dZddlmZ ddlmZ ddlm	Z	 ddl
mZ ddlmZ ee	eeedZd	ed
<   	 	 	 d=d>dZd Zddddddddddddddddej        fd?d0Zed1             Zed2             Zd@d3ZdAd5ZdBd<ZdS )Crz   a  
    Class for parsing tabular Excel sheets into DataFrame objects.

    See read_excel for more documentation.

    Parameters
    ----------
    path_or_buffer : str, bytes, pathlib.Path,
        A file-like object, xlrd workbook or openpyxl workbook.
        If a string or path object, expected to be a path to a
        .xls, .xlsx, .xlsb, .xlsm, .odf, .ods, or .odt file.
    engine : str, default None
        If io is not a buffer or path, this must be set to identify io.
        Supported engines: ``xlrd``, ``openpyxl``, ``odf``, ``pyxlsb``, ``calamine``
        Engine compatibility :

        - ``xlrd`` supports old-style Excel files (.xls).
        - ``openpyxl`` supports newer Excel file formats.
        - ``odf`` supports OpenDocument file formats (.odf, .ods, .odt).
        - ``pyxlsb`` supports Binary Excel files.
        - ``calamine`` supports Excel (.xls, .xlsx, .xlsm, .xlsb)
          and OpenDocument (.ods) file formats.

        The engine `xlrd <https://xlrd.readthedocs.io/en/latest/>`_
        now only supports old-style ``.xls`` files.
        When ``engine=None``, the following logic will be
        used to determine the engine:

        - If ``path_or_buffer`` is an OpenDocument format (.odf, .ods, .odt),
            then `odf <https://pypi.org/project/odfpy/>`_ will be used.
        - Otherwise if ``path_or_buffer`` is an xls format,
            ``xlrd`` will be used.
        - Otherwise if ``path_or_buffer`` is in xlsb format,
            `pyxlsb <https://pypi.org/project/pyxlsb/>`_ will be used.
        - Otherwise if `openpyxl <https://pypi.org/project/openpyxl/>`_ is installed,
            then ``openpyxl`` will be used.
        - Otherwise if ``xlrd >= 2.0`` is installed, a ``ValueError`` will be raised.

        .. warning::

           Please do not report issues when using ``xlrd`` to read ``.xlsx`` files.
           This is not supported, switch to using ``openpyxl`` instead.
    storage_options : dict, optional
        Extra options that make sense for a particular storage connection, e.g.
        host, port, username, password, etc. For HTTP(S) URLs the key-value pairs
        are forwarded to ``urllib.request.Request`` as header options. For other
        URLs (e.g. starting with "s3://", and "gcs://") the key-value pairs are
        forwarded to ``fsspec.open``. Please see ``fsspec`` and ``urllib`` for more
        details, and for more examples on storage options refer `here
        <https://pandas.pydata.org/docs/user_guide/io.html?
        highlight=storage_options#reading-writing-remote-files>`_.
    engine_kwargs : dict, optional
        Arbitrary keyword arguments passed to excel engine.

    See Also
    --------
    DataFrame.to_excel : Write DataFrame to an Excel file.
    DataFrame.to_csv : Write DataFrame to a comma-separated values (csv) file.
    read_csv : Read a comma-separated values (csv) file into DataFrame.
    read_fwf : Read a table of fixed-width formatted lines into DataFrame.

    Examples
    --------
    >>> file = pd.ExcelFile("myfile.xlsx")  # doctest: +SKIP
    >>> with pd.ExcelFile("myfile.xls") as xls:  # doctest: +SKIP
    ...     df1 = pd.read_excel(xls, "Sheet1")  # doctest: +SKIP
    r   )CalamineReader)	ODFReader)OpenpyxlReader)PyxlsbReader)
XlrdReader)xlrdopenpyxlodfpyxlsbcalaminezMapping[str, Any]_enginesNr@   ra   rP   ru   rs   rv   re   r   c                   |i }||| j         vrt          d|           t          |          | _        |d }t	          |t
          t          j        t          f          s\t          |          sMt          dd          d }n dd l}t          t          |                    }|t	          ||j                  rd}|"t          ||          }|t          d          t!          j        d	| d
          }|dk    rt%          |d          }|J || _        || _         | j         |         | j        ||          | _        d S )NzUnknown engine: r  ignore)errorsr   rl  )rf  rP   zLExcel file format cannot be determined, you must specify an engine manually.r  z.readerr  readerr
  )rP   rs   )r  r{   r'   _iory   rb   r  PathLikerz   r   r   r  r$   r   Bookr  r   r  r*   r@   rP   _reader)r   path_or_bufferr@   rP   rs   r  xlrd_versionr  s           rk   r   zExcelFile.__init__!  s     M&"="=888999 ".11>"Cbk9 =   ">22  .fXFFFN#'LLKKK#*;t+<+<#=#=L+
>490U0U+C{*$2O   ;$.  
 &'?3'?'?'?@@F+Ch???!!!.,t}V,H+'
 
 
rm   c                    | j         S rg   )r  r   s    rk   r;  zExcelFile.__fspath__[  s	    xrm   FrR   r   r;   rT   r<   rU   r=   rB   r[   rC   rD   r\   rE   r]   rJ   r_   rK    str | dict[Hashable, str] | NonerL   rN   rO   rc   rQ   rd   7DataFrame | dict[str, DataFrame] | dict[int, DataFrame]c                     | j         j        di d|d|d|d|d|d|d|d|d	|	d
|
d|d|d|d|d|d|d||S )a~  
        Parse specified sheet(s) into a DataFrame.

        Equivalent to read_excel(ExcelFile, ...)  See the read_excel
        docstring for more info on accepted parameters.

        Parameters
        ----------
        sheet_name : str, int, list, or None, default 0
            Strings are used for sheet names. Integers are used in zero-indexed
            sheet positions (chart sheets do not count as a sheet position).
            Lists of strings/integers are used to request multiple sheets.
            When ``None``, will return a dictionary containing DataFrames for
            each sheet.
        header : int, list of int, default 0
            Row (0-indexed) to use for the column labels of the parsed
            DataFrame. If a list of integers is passed those row positions will
            be combined into a ``MultiIndex``. Use None if there is no header.
        names : array-like, default None
            List of column names to use. If file contains no header row,
            then you should explicitly pass header=None.
        index_col : int, str, list of int, default None
            Column (0-indexed) to use as the row labels of the DataFrame.
            Pass None if there is no such column.  If a list is passed,
            those columns will be combined into a ``MultiIndex``.  If a
            subset of data is selected with ``usecols``, index_col
            is based on the subset.

            Missing values will be forward filled to allow roundtripping with
            ``to_excel`` for ``merged_cells=True``. To avoid forward filling the
            missing values use ``set_index`` after reading the data instead of
            ``index_col``.
        usecols : str, list-like, or callable, default None
            * If None, then parse all columns.
            * If str, then indicates comma separated list of Excel column letters
              and column ranges (e.g. "A:E" or "A,C,E:F"). Ranges are inclusive of
              both sides.
            * If list of int, then indicates list of column numbers to be parsed
              (0-indexed).
            * If list of string, then indicates list of column names to be parsed.
            * If callable, then evaluate each column name against it and parse the
              column if the callable returns ``True``.

            Returns a subset of the columns according to behavior above.
        converters : dict, default None
            Dict of functions for converting values in certain columns. Keys can
            either be integers or column labels, values are functions that take one
            input argument, the Excel cell content, and return the transformed
            content.
        true_values : list, default None
            Values to consider as True.
        false_values : list, default None
            Values to consider as False.
        skiprows : list-like, int, or callable, optional
            Line numbers to skip (0-indexed) or number of lines to skip (int) at the
            start of the file. If callable, the callable function will be evaluated
            against the row indices, returning True if the row should be skipped and
            False otherwise. An example of a valid callable argument would be ``lambda
            x: x in [0, 2]``.
        nrows : int, default None
            Number of rows to parse.
        na_values : scalar, str, list-like, or dict, default None
            Additional strings to recognize as NA/NaN. If dict passed, specific
            per-column NA values.
        parse_dates : bool, list-like, or dict, default False
            The behavior is as follows:

            * ``bool``. If True -> try parsing the index.
            * ``list`` of int or names. e.g. If [1, 2, 3] -> try parsing columns 1, 2, 3
              each as a separate date column.
            * ``list`` of lists. e.g.  If [[1, 3]] -> combine columns 1 and 3 and
              parse as a single date column.
            * ``dict``, e.g. {{'foo' : [1, 3]}} -> parse columns 1, 3 as date and call
              result 'foo'

            If a column or index contains an unparsable date, the entire column or
            index will be returned unaltered as an object data type. If you
            don`t want to parse some cells as date just change their type
            in Excel to "Text".For non-standard datetime parsing, use
            ``pd.to_datetime`` after ``pd.read_excel``.

            Note: A fast-path exists for iso8601-formatted dates.
        date_format : str or dict of column -> format, default ``None``
           If used in conjunction with ``parse_dates``, will parse dates
           according to this format. For anything more complex,
           please read in as ``object`` and then apply :func:`to_datetime` as-needed.
        thousands : str, default None
            Thousands separator for parsing string columns to numeric.  Note that
            this parameter is only necessary for columns stored as TEXT in Excel,
            any numeric columns will automatically be parsed, regardless of display
            format.
        comment : str, default None
            Comments out remainder of line. Pass a character or characters to this
            argument to indicate comments in the input file. Any data between the
            comment string and the end of the current line is ignored.
        skipfooter : int, default 0
            Rows at the end to skip (0-indexed).
        dtype_backend : {{'numpy_nullable', 'pyarrow'}}
            Back-end data type applied to the resultant :class:`DataFrame`
            (still experimental). If not specified, the default behavior
            is to not use nullable data types. If specified, the behavior
            is as follows:

            * ``"numpy_nullable"``: returns nullable-dtype-backed :class:`DataFrame`
            * ``"pyarrow"``: returns pyarrow-backed nullable
              :class:`ArrowDtype` :class:`DataFrame`

            .. versionadded:: 2.0
        **kwds : dict, optional
            Arbitrary keyword arguments passed to excel engine.

        Returns
        -------
        DataFrame or dict of DataFrames
            DataFrame from the passed in Excel file.

        See Also
        --------
        read_excel : Read an Excel sheet values (xlsx) file into DataFrame.
        read_csv : Read a comma-separated values (csv) file into DataFrame.
        read_fwf : Read a table of fixed-width formatted lines into DataFrame.

        Examples
        --------
        >>> df = pd.DataFrame([[1, 2, 3], [4, 5, 6]], columns=["A", "B", "C"])
        >>> df.to_excel("myfile.xlsx")  # doctest: +SKIP
        >>> file = pd.ExcelFile("myfile.xlsx")  # doctest: +SKIP
        >>> file.parse()  # doctest: +SKIP
        rR   r;   r<   r=   r>   rA   rB   rC   rD   rE   rF   rJ   rK   rL   rN   rO   rQ   rh   )r  r|   )r   rR   r;   r<   r=   r>   rA   rB   rC   rD   rE   rF   rJ   rK   rL   rN   rO   rQ   r   s                      rk   r|   zExcelFile.parse^  s    l "t|! 
 
 
!z
6
 %
  i	

 G
 "z
 $
 &
 X
 %
  i
 $
 $
  i
 G
  "z!
" (-%
 
 	
rm   c                    | j         j        S )aF  
        Gets the Excel workbook.

        Workbook is the top-level container for all document information.

        Returns
        -------
        Excel Workbook
            The workbook object of the type defined by the engine being used.

        See Also
        --------
        read_excel : Read an Excel file into a pandas DataFrame.

        Examples
        --------
        >>> file = pd.ExcelFile("myfile.xlsx")  # doctest: +SKIP
        >>> file.book  # doctest: +SKIP
        <openpyxl.workbook.workbook.Workbook object at 0x11eb5ad70>
        >>> file.book.path  # doctest: +SKIP
        '/xl/workbook.xml'
        >>> file.book.active  # doctest: +SKIP
        <openpyxl.worksheet._read_only.ReadOnlyWorksheet object at 0x11eb5b370>
        >>> file.book.sheetnames  # doctest: +SKIP
        ['Sheet1', 'Sheet2']
        )r  r   r   s    rk   r   zExcelFile.book	  s    8 |  rm   c                    | j         j        S )a  
        Names of the sheets in the document.

        This is particularly useful for loading a specific sheet into a DataFrame when
        you do not know the sheet names beforehand.

        Returns
        -------
        list of str
            List of sheet names in the document.

        See Also
        --------
        ExcelFile.parse : Parse a sheet into a DataFrame.
        read_excel : Read an Excel file into a pandas DataFrame. If you know the sheet
            names, it may be easier to specify them directly to read_excel.

        Examples
        --------
        >>> file = pd.ExcelFile("myfile.xlsx")  # doctest: +SKIP
        >>> file.sheet_names  # doctest: +SKIP
        ["Sheet1", "Sheet2"]
        )r  r   r   s    rk   r   zExcelFile.sheet_names'  s    2 |''rm   c                8    | j                                          dS )zclose io if necessaryN)r  r}   r   s    rk   r}   zExcelFile.closeB  s    rm   r   c                    | S rg   rh   r   s    rk   rT  zExcelFile.__enter__F  rU  rm   rV  rW  rX  rY  rZ  r[  c                .    |                                   d S rg   r]  r^  s       rk   r_  zExcelFile.__exit__I  r`  rm   )NNN)r@   ra   rP   ru   rs   rv   re   r   )rR   r   r;   rT   r<   rU   r=   rT   rB   r[   rC   r[   rD   r\   rE   r]   rJ   r_   rK   r  rL   ra   rN   ra   rO   rc   rQ   rd   re   r  r   rb  rc  )r   r   r   rd  pandas.io.excel._calaminer  pandas.io.excel._odfreaderr  pandas.io.excel._openpyxlr  pandas.io.excel._pyxlsbr  pandas.io.excel._xlrdr  r  r   r   r;  r   r   r|   r   r   r   r}   rT  r_  rh   rm   rk   rz   rz     s        B BH 988888444444888888444444000000 ""# #H     "15%)8
 8
 8
 8
 8
t  
 @A-.9=041526IM */8< $"69n%i
 i
 i
 i
 i
V ! ! X!: ( ( X(4           rm   rz   ).)0rR   rS   r;   rT   r<   rU   r=   rV   r>   rW   r?   rX   r@   rY   rA   rZ   rB   r[   rC   r[   rD   r\   rE   r]   rG   r^   rH   r^   rI   r^   rJ   r_   rK   r`   rL   ra   rM   rb   rN   ra   rO   rc   rP   r9   rQ   rd   re   r#   )0rR   rn   r;   rT   r<   rU   r=   rV   r>   rW   r?   rX   r@   rY   rA   rZ   rB   r[   rC   r[   rD   r\   rE   r]   rG   r^   rH   r^   rI   r^   rJ   r_   rK   r`   rL   ra   rM   rb   rN   ra   rO   rc   rP   r9   rQ   rd   re   ro   )r   )2rR   rt   r;   rT   r<   rU   r=   rV   r>   rW   r?   rX   r@   rY   rA   rZ   rB   r[   rC   r[   rD   r\   rE   r]   rG   r^   rH   r^   rI   r^   rJ   r_   rK   r`   rL   ra   rM   rb   rN   ra   rO   rc   rP   ru   rQ   rd   rs   rv   re   rw   rg   )rf  rg  rP   ru   re   ra   )^
__future__r   collections.abcr   r   r   r   r   rC  rM   r	   	functoolsr
   r  typingr   r   r   r   r   r   r   r   r   r   rG  rx  pandas._configr   pandas._libsr   pandas.compat._optionalr   r   pandas.errorsr   pandas.util._decoratorsr   pandas.util._exceptionsr   pandas.util._validatorsr   pandas.core.dtypes.commonr   r   r   r    r!   r"   pandas.core.framer#   pandas.util.versionr$   pandas.io.commonr%   r&   r'   r(   pandas.io.excel._utilr)   r*   r+   r,   r-   pandas.io.parsersr.   pandas.io.parsers.readersr/   typesr0   pandas._typingr1   r2   r3   r4   r5   r6   r7   r8   r9   r:   rl   r   r   r   r   rv  rw  r   mapr   ru  r  rz   rh   rm   rk   <module>r     sE   " " " " " "                           				                          ! ! ! ! ! !              ) ( ( ( ( (      5 4 4 4 4 4 7 7 7 7 7 7                ( ' ' ' ' ' ' ' ' ' ' '                         ) ( ( ( ( ( 6 6 6 6 6 6 ######                        
  !
 *-5825  NQCF-0.1EH&)47&)25A! ! ! ! ! 
!H 
 *-5825  NQCF-0.1EH&)47&)25A!# !# !# !# !# 
!#H H 45g *+5926 !NRCG-1.2EI &+48 -125.!%Ag g g g g gT W\""
h h h h hgj) h h hV H@ @ @ @ @'*% @ @ @F CC9>9=99::;;	
 .2A A A A AH HA A A A A A A A A Arm   