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

Function read_feather

pandas/io/feather_format.py:81–181  ·  view source on GitHub ↗

Load a feather-format object from the file path. Feather is particularly useful for scenarios that require efficient serialization and deserialization of tabular data. It supports schema preservation, making it a reliable choice for use cases such as sharing data between Python

(
    path: FilePath | ReadBuffer[bytes],
    columns: Sequence[Hashable] | None = None,
    use_threads: bool = True,
    storage_options: StorageOptions | None = None,
    dtype_backend: DtypeBackend | lib.NoDefault = lib.no_default,
)

Source from the content-addressed store, hash-verified

79
80@set_module("pandas")
81def read_feather(
82 path: FilePath | ReadBuffer[bytes],
83 columns: Sequence[Hashable] | None = None,
84 use_threads: bool = True,
85 storage_options: StorageOptions | None = None,
86 dtype_backend: DtypeBackend | lib.NoDefault = lib.no_default,
87) -> DataFrame:
88 """
89 Load a feather-format object from the file path.
90
91 Feather is particularly useful for scenarios that require efficient
92 serialization and deserialization of tabular data. It supports
93 schema preservation, making it a reliable choice for use cases
94 such as sharing data between Python and R, or persisting intermediate
95 results during data processing pipelines. This method provides additional
96 flexibility with options for selective column reading, thread parallelism,
97 and choosing the backend for data types.
98
99 Parameters
100 ----------
101 path : str, path object, or file-like object
102 String, path object (implementing ``os.PathLike[str]``), or file-like
103 object implementing a binary ``read()`` function. The string could be a URL.
104 Valid URL schemes include http, ftp, s3, gs and file. For file URLs, a host is
105 expected. A local file could be: ``file://localhost/path/to/table.feather``.
106 columns : sequence, default None
107 If not provided, all columns are read.
108 use_threads : bool, default True
109 Whether to parallelize reading using multiple threads.
110 storage_options : dict, optional
111 Extra options that make sense for a particular storage connection, e.g.
112 host, port, username, password, etc. For HTTP(S) URLs the key-value pairs
113 are forwarded to ``urllib.request.Request`` as header options. For other
114 URLs (e.g. starting with "s3://", and "gcs://") the key-value pairs are
115 forwarded to ``fsspec.open``. Please see ``fsspec`` and ``urllib`` for more
116 details, and for more examples on storage options refer `here
117 <https://pandas.pydata.org/docs/user_guide/io.html?
118 highlight=storage_options#reading-writing-remote-files>`_.
119
120 dtype_backend : {'numpy_nullable', 'pyarrow'}
121 Back-end data type applied to the resultant :class:`DataFrame`
122 (still experimental). If not specified, the default behavior
123 is to not use nullable data types. If specified, the behavior
124 is as follows:
125
126 * ``"numpy_nullable"``: returns nullable-dtype-backed :class:`DataFrame`.
127 * ``"pyarrow"``: returns pyarrow-backed nullable
128 :class:`ArrowDtype` :class:`DataFrame`
129
130 .. versionadded:: 2.0
131
132 Returns
133 -------
134 type of object stored in file
135 DataFrame object stored in the file.
136
137 See Also
138 --------

Calls 7

check_dtype_backendFunction · 0.90
get_handleFunction · 0.90
using_string_dtypeFunction · 0.90
arrow_table_to_pandasFunction · 0.90
astypeMethod · 0.45
read_tableMethod · 0.45