MCPcopy
hub / github.com/pandas-dev/pandas / to_feather

Function to_feather

pandas/io/feather_format.py:42–77  ·  view source on GitHub ↗

Write a DataFrame to the binary Feather format. Parameters ---------- df : DataFrame path : str, path object, or file-like object storage_options : dict, optional Extra options that make sense for a particular storage connection, e.g. host, port, username, p

(
    df: DataFrame,
    path: FilePath | WriteBuffer[bytes],
    storage_options: StorageOptions | None = None,
    **kwargs: Any,
)

Source from the content-addressed store, hash-verified

40
41
42def to_feather(
43 df: DataFrame,
44 path: FilePath | WriteBuffer[bytes],
45 storage_options: StorageOptions | None = None,
46 **kwargs: Any,
47) -> None:
48 """
49 Write a DataFrame to the binary Feather format.
50
51 Parameters
52 ----------
53 df : DataFrame
54 path : str, path object, or file-like object
55 storage_options : dict, optional
56 Extra options that make sense for a particular storage connection, e.g.
57 host, port, username, password, etc. For HTTP(S) URLs the key-value pairs
58 are forwarded to ``urllib.request.Request`` as header options. For other
59 URLs (e.g. starting with "s3://", and "gcs://") the key-value pairs are
60 forwarded to ``fsspec.open``. Please see ``fsspec`` and ``urllib`` for more
61 details, and for more examples on storage options refer `here
62 <https://pandas.pydata.org/docs/user_guide/io.html?
63 highlight=storage_options#reading-writing-remote-files>`_.
64 **kwargs :
65 Additional keywords passed to `pyarrow.feather.write_feather`.
66
67 """
68 import_optional_dependency("pyarrow")
69 from pyarrow import feather
70
71 if not isinstance(df, DataFrame):
72 raise ValueError("feather only support IO with DataFrames")
73
74 with get_handle(
75 path, "wb", storage_options=storage_options, is_text=False
76 ) as handles:
77 feather.write_feather(df, handles.handle, **kwargs)
78
79
80@set_module("pandas")

Callers 5

to_featherMethod · 0.90
check_error_on_writeMethod · 0.90
check_round_tripMethod · 0.90

Calls 2

get_handleFunction · 0.90

Tested by 4

check_error_on_writeMethod · 0.72
check_round_tripMethod · 0.72