From cb7e4f3bde61584f7f3ada162251a9563caf74f2 Mon Sep 17 00:00:00 2001 From: Thierry Moisan Date: Mon, 7 Mar 2022 21:34:42 -0500 Subject: [PATCH] TYP: add type annotation to DataFrame.to_pickle --- pandas/core/generic.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index a0621e1ff9306..80af10383e24e 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -2956,7 +2956,7 @@ def to_sql( ) def to_pickle( self, - path, + path: FilePath | WriteBuffer[bytes], compression: CompressionOptions = "infer", protocol: int = pickle.HIGHEST_PROTOCOL, storage_options: StorageOptions = None, @@ -2966,8 +2966,10 @@ def to_pickle( Parameters ---------- - path : str - File path where the pickled object will be stored. + path : str, path object, or file-like object + String, path object (implementing ``os.PathLike[str]``), or file-like + object implementing a binary ``write()`` function. File path where + the pickled object will be stored. {compression_options} protocol : int Int which indicates which protocol should be used by the pickler,