Sindbad~EG File Manager

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

�

Mٜg� ��:�dZddlmZddlZddlmZddlmZmZm	Z	ddl
mZddlm
Z
ddlmZdd	lmZddlZdd
lmZddlmZddlmZmZerddlZddlZdd
lmZm Z m!Z!m"Z"ddl#m$Z$de
jJdf											dd�Z&	ddddd�											dd�Z'y)z orc compat �)�annotationsN)�
ModuleType)�
TYPE_CHECKING�Any�Literal)�using_pyarrow_string_dtype)�lib)�import_optional_dependency)�check_dtype_backend)�
default_index)�arrow_string_types_mapper)�
get_handle�
is_fsspec_url)�DtypeBackend�FilePath�
ReadBuffer�WriteBuffer)�	DataFramec��td�}t|�t|dd��5}|j}t	|�r7|�5td�}td�}		|	j
j
|�\}}|jd|||d�|��}
ddd�|tjurR|dk(r"
jtj�	�}|Sd
dlm}|�}

j|
j"�	�}|St%�rt'�}nd}
j|�	�S#t|jf$rY��wxYw#1swY��xYw)
a�
    Load an ORC object from the file path, returning a DataFrame.

    Parameters
    ----------
    path : str, path object, or file-like object
        String, path object (implementing ``os.PathLike[str]``), or file-like
        object implementing a binary ``read()`` function. 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.orc``.
    columns : list, default None
        If not None, only these columns will be read from the file.
        Output always follows the ordering of the file and not the columns list.
        This mirrors the original behaviour of
        :external+pyarrow:py:meth:`pyarrow.orc.ORCFile.read`.
    dtype_backend : {'numpy_nullable', 'pyarrow'}, default 'numpy_nullable'
        Back-end data type applied to the resultant :class:`DataFrame`
        (still experimental). Behaviour is as follows:

        * ``"numpy_nullable"``: returns nullable-dtype-backed :class:`DataFrame`
          (default).
        * ``"pyarrow"``: returns pyarrow-backed nullable :class:`ArrowDtype`
          DataFrame.

        .. versionadded:: 2.0

    filesystem : fsspec or pyarrow filesystem, default None
        Filesystem object to use when reading the parquet file.

        .. versionadded:: 2.1.0

    **kwargs
        Any additional kwargs are passed to pyarrow.

    Returns
    -------
    DataFrame

    Notes
    -----
    Before using this function you should read the :ref:`user guide about ORC <io.orc>`
    and :ref:`install optional dependencies <install.warn_orc>`.

    If ``path`` is a URI scheme pointing to a local or remote file (e.g. "s3://"),
    a ``pyarrow.fs`` filesystem will be attempted to read the file. You can also pass a
    pyarrow or fsspec filesystem object into the filesystem keyword to override this
    behavior.

    Examples
    --------
    >>> result = pd.read_orc("example_pa.orc")  # doctest: +SKIP
    �pyarrow.orc�rbF��is_textN�pyarrowz
pyarrow.fs)�source�columns�
filesystem)�types_mapperr)�_arrow_dtype_mapping�)r
rr�handler�
FileSystem�from_uri�	TypeError�ArrowInvalid�
read_tabler	�
no_default�	to_pandas�pd�
ArrowDtype�pandas.io._utilr�getrr
)�pathr�
dtype_backendr�kwargs�orc�handlesr�pa�pa_fs�pa_table�dfr�mappingrs               �8/usr/local/lib/python3.12/site-packages/pandas/io/orc.py�read_orcr8)sD��|%�]�
3�C��
�&�	�D�$��	.�'��������:�#5�+�I�6�B�.�|�<�E�
�%*�%5�%5�%>�%>�t�%D�"�
�F�"�3�>�>�
��7�z�
�EK�
��
/��C�N�N�*��I�%��#�#����#�?�B��	�	
=�*�,�G��#�#����#�=�B��	�%�'�4�6�L��L��!�!�|�!�<�<��)�r���/�
��
��
/�	.�s/�0D:�D�4D:�D7�4D:�6D7�7D:�:Er)�engine�index�
engine_kwargsc�(�|�|jjddu}|�i}|jjtt	|���std��|jj�td��|dk7rtd��t|d��}td�}td	�}|du}|rtj�}|�J�t|d
d��5}t|t�sJ�	|j|jj||�
�|j fi|��	ddd�|r,t|tj�sJ�|j)�Sy#t"|j$f$r}	t'd�|	�d}	~	wwxYw#1swY�axYw)aj
    Write a DataFrame to the ORC format.

    .. versionadded:: 1.5.0

    Parameters
    ----------
    df : DataFrame
        The dataframe to be written to ORC. Raises NotImplementedError
        if dtype of one or more columns is category, unsigned integers,
        intervals, periods or sparse.
    path : str, file-like object or None, default None
        If a string, it will be used as Root Directory path
        when writing a partitioned dataset. By file-like object,
        we refer to objects with a write() method, such as a file handle
        (e.g. via builtin open function). If path is None,
        a bytes object is returned.
    engine : str, default 'pyarrow'
        ORC library to use.
    index : bool, optional
        If ``True``, include the dataframe's index(es) in the file output. If
        ``False``, they will not be written to the file.
        If ``None``, similar to ``infer`` the dataframe's index(es)
        will be saved. However, instead of being saved as values,
        the RangeIndex will be stored as a range in the metadata so it
        doesn't require much space and is faster. Other indexes will
        be included as columns in the file output.
    engine_kwargs : dict[str, Any] or None, default None
        Additional keyword arguments passed to :func:`pyarrow.orc.write_table`.

    Returns
    -------
    bytes if no path argument is provided else None

    Raises
    ------
    NotImplementedError
        Dtype of one or more columns is category, unsigned integers, interval,
        period or sparse.
    ValueError
        engine is not pyarrow.

    Notes
    -----
    * Before using this function you should read the
      :ref:`user guide about ORC <io.orc>` and
      :ref:`install optional dependencies <install.warn_orc>`.
    * This function requires `pyarrow <https://arrow.apache.org/docs/python/>`_
      library.
    * For supported dtypes please refer to `supported ORC features in Arrow
      <https://arrow.apache.org/docs/cpp/orc.html#data-types>`__.
    * Currently timezones in datetime columns are not preserved when a
      dataframe is converted into ORC files.
    Nrz{orc does not support serializing a non-default index for the index; you can .reset_index() to make the index into column(s)z9orc does not serialize index meta-data on a default indexrzengine must be 'pyarrow'z10.0.1)�min_versionr�wbFr)�preserve_indexz6The dtype of one or more columns is not supported yet.)r:�names�equalsr�len�
ValueError�namer
�io�BytesIOr�
isinstancer�write_table�Table�from_pandasr!r$�ArrowNotImplementedError�NotImplementedError�getvalue)
r5r-r9r:r;r2r0�was_noner1�es
          r7�to_orcrP�s���|
�}������q�!��-�����
��8�8�?�?�=��R��1�2��
F�
�	
�

�x�x�}�}� ��T�U�U�
����3�4�4�
'��H�
E�F�	#�I�	.�B�
$�]�
3�C��t�|�H���z�z�|������	�D�$��	.�'��&�*�-�-�-�		��C�O�O����(�(��E�(�B����
� �
�
/���$��
�
�+�+�+��}�}������2�6�6�7�	�%�H���
��	��
/�	.�s*�F�.9E�F�4F�F�F�F)r-zFilePath | ReadBuffer[bytes]rzlist[str] | Noner.zDtypeBackend | lib.NoDefaultrz=pyarrow.fs.FileSystem | fsspec.spec.AbstractFileSystem | Noner/r�returnr)N)r5rr-z$FilePath | WriteBuffer[bytes] | Noner9zLiteral['pyarrow']r:zbool | Noner;zdict[str, Any] | NonerQzbytes | None)(�__doc__�
__future__rrE�typesr�typingrrr�pandas._configr�pandas._libsr	�pandas.compat._optionalr
�pandas.util._validatorsr�pandasr)�pandas.core.indexes.apirr+r
�pandas.io.commonrr�fsspec�
pyarrow.fsr�pandas._typingrrrr�pandas.core.framerr'r8rPr �r7�<module>rbs���"�	����6��>�7��1�5��
�����,�
!%�25�.�.�PT�	]=�
&�]=�
�]=�0�]=�N�	]=�
�]=��
]=�D26�l�"+��+/�
l��l�
.�l�
�	l�
�l�)�
l��lra

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