Skip to content

Commit 1f49b76

Browse files
authored
DOC: update DataFrame.to_feather docstring (#35408)
1 parent e67220d commit 1f49b76

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

pandas/core/frame.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -2202,14 +2202,14 @@ def to_stata(
22022202
writer.write_file()
22032203

22042204
@deprecate_kwarg(old_arg_name="fname", new_arg_name="path")
2205-
def to_feather(self, path, **kwargs) -> None:
2205+
def to_feather(self, path: FilePathOrBuffer[AnyStr], **kwargs) -> None:
22062206
"""
22072207
Write a DataFrame to the binary Feather format.
22082208
22092209
Parameters
22102210
----------
2211-
path : str
2212-
String file path.
2211+
path : str or file-like object
2212+
If a string, it will be used as Root Directory path.
22132213
**kwargs :
22142214
Additional keywords passed to :func:`pyarrow.feather.write_feather`.
22152215
Starting with pyarrow 0.17, this includes the `compression`,

pandas/io/feather_format.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
""" feather-format compat """
22

3-
from pandas._typing import StorageOptions
3+
from typing import AnyStr
4+
5+
from pandas._typing import FilePathOrBuffer, StorageOptions
46
from pandas.compat._optional import import_optional_dependency
57

68
from pandas import DataFrame, Int64Index, RangeIndex
79

810
from pandas.io.common import get_filepath_or_buffer
911

1012

11-
def to_feather(df: DataFrame, path, storage_options: StorageOptions = None, **kwargs):
13+
def to_feather(
14+
df: DataFrame,
15+
path: FilePathOrBuffer[AnyStr],
16+
storage_options: StorageOptions = None,
17+
**kwargs,
18+
):
1219
"""
1320
Write a DataFrame to the binary Feather format.
1421

0 commit comments

Comments
 (0)