3
���h� � @ sV d Z ddlmZ ddlmZmZmZ ddlmZm Z ed�dd�Z
d
ed
�dd�ZdS )z feather-format compat � )�import_optional_dependency)� DataFrame�
Int64Index�
RangeIndex)�get_filepath_or_buffer�stringify_path)�dfc K s� t d� ddlm} t|�}t| t�s.td��ddh}t| jt�s\t | j�}td|� d���| jj
tjt
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)r r r
r �
isinstancer �
ValueError�indexr �type�equalsr Z
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& |