HOME


sh-3ll 1.0
DIR:/usr/local/lib64/python3.6/site-packages/pandas/io/__pycache__/
Upload File :
Current File : //usr/local/lib64/python3.6/site-packages/pandas/io/__pycache__/feather_format.cpython-36.pyc
3

���h��@sVdZddlmZddlmZmZmZddlmZm	Z	ed�dd�Z
d
ed
�dd�ZdS)z feather-format compat �)�import_optional_dependency)�	DataFrame�
Int64Index�
RangeIndex)�get_filepath_or_buffer�stringify_path)�dfcKs�td�ddlm}t|�}t|t�s.td��ddh}t|jt�s\t	|j�}td|�d���|jj
tjt
t|����s~td	��|jjd
k	r�td��|jj|kr�td��|j||f|�d
S)
a
    Write a DataFrame to the binary Feather format.

    Parameters
    ----------
    df : DataFrame
    path : string file path, or file-like object
    **kwargs :
        Additional keywords passed to `pyarrow.feather.write_feather`.

        .. versionadded:: 1.1.0
    �pyarrowr)�featherz'feather only support IO with DataFrames�string�unicodez%feather does not support serializing zG for the index; you can .reset_index() to make the index into column(s)zfeather does not support serializing a non-default index for the index; you can .reset_index() to make the index into column(s)Nz=feather does not serialize index meta-data on a default indexz%feather must have string column names)rr	r
r�
isinstancer�
ValueError�indexr�type�equalsrZ
from_range�range�len�name�columnsZ
inferred_typeZ
write_feather)r�path�kwargsr
Zvalid_types�typ�r�:/tmp/pip-build-5_djhm0z/pandas/pandas/io/feather_format.py�
to_feather
s&


rNT)�use_threadscCsHtd�ddlm}t|�\}}}}|j||t|�d�}|rD|j�|S)a�
    Load a feather-format object from the file path.

    Parameters
    ----------
    path : str, 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.feather``.

        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 handler (e.g. via builtin ``open`` function)
        or ``StringIO``.
    columns : sequence, default None
        If not provided, all columns are read.

        .. versionadded:: 0.24.0
    use_threads : bool, default True
        Whether to parallelize reading using multiple threads.

       .. versionadded:: 0.24.0

    Returns
    -------
    type of object stored in file
    r	r)r
)rr)rr	r
r�read_feather�bool�close)rrrr
�_Zshould_closerrrrrCsr)NT)
�__doc__Zpandas.compat._optionalrZpandasrrrZpandas.io.commonrrrrrrrrr�<module>s
9