Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -2216,14 +2216,14 @@ def to_stata(
writer.write_file()

@deprecate_kwarg(old_arg_name="fname", new_arg_name="path")
def to_feather(self, path, **kwargs) -> None:
def to_feather(self, path: FilePathOrBuffer[AnyStr], **kwargs) -> None:
"""
Write a DataFrame to the binary Feather format.

Parameters
----------
path : str
String file path.
path : str or file-like object
If a string, it will be used as Root Directory path.
**kwargs :
Additional keywords passed to :func:`pyarrow.feather.write_feather`.
Starting with pyarrow 0.17, this includes the `compression`,
Expand Down
11 changes: 9 additions & 2 deletions pandas/io/feather_format.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
""" feather-format compat """

from pandas._typing import StorageOptions
from typing import AnyStr

from pandas._typing import FilePathOrBuffer, StorageOptions
from pandas.compat._optional import import_optional_dependency

from pandas import DataFrame, Int64Index, RangeIndex

from pandas.io.common import get_filepath_or_buffer


def to_feather(df: DataFrame, path, storage_options: StorageOptions = None, **kwargs):
def to_feather(
df: DataFrame,
path: FilePathOrBuffer[AnyStr],
storage_options: StorageOptions = None,
**kwargs,
):
"""
Write a DataFrame to the binary Feather format.

Expand Down