pandas.DataFrame.to_feather#

DataFrame.to_feather(path, **kwargs)[源代码]#

将 DataFrame 写入二进制 Feather 格式。

Parameters:
pathstr, path object, file-like object

字符串、路径对象(实现 os.PathLike[str])或实现二进制 write() 函数的文件类对象。如果为字符串或路径,则在写入分区数据集时将其用作根目录路径。

**kwargs

传递给 pyarrow.feather.write_feather() 的附加关键字。这包括 compressioncompression_levelchunksizeversion 关键字。

Notes

此函数将 DataFrame 写入 feather file 。需要默认索引。要使用自定义索引保存 DataFrame,请使用支持自定义索引的方法,例如 to_parquet

Examples

>>> df = pd.DataFrame([[1, 2, 3], [4, 5, 6]])
>>> df.to_feather("file.feather")