File tree 2 files changed +8
-6
lines changed
2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 1
1
""" pickle compat """
2
2
import pickle
3
- from typing import Any , Optional
3
+ from typing import Optional
4
4
import warnings
5
5
6
- from pandas ._typing import FilePathOrBuffer
6
+ from pandas ._typing import FilePathOrBuffer , FrameOrSeries
7
7
from pandas .compat import pickle_compat as pc
8
8
9
9
from pandas .io .common import get_filepath_or_buffer , get_handle
10
10
11
11
12
12
def to_pickle (
13
- obj : Any ,
13
+ obj : FrameOrSeries ,
14
14
filepath_or_buffer : FilePathOrBuffer ,
15
15
compression : Optional [str ] = "infer" ,
16
16
protocol : int = pickle .HIGHEST_PROTOCOL ,
@@ -20,7 +20,7 @@ def to_pickle(
20
20
21
21
Parameters
22
22
----------
23
- obj : any object
23
+ obj : any pandas object
24
24
Any python object.
25
25
filepath_or_buffer : str, path object or file-like object
26
26
File path, URL, or buffer where the pickled object will be stored.
Original file line number Diff line number Diff line change 22
22
)
23
23
24
24
import pandas ._libs .testing as _testing
25
- from pandas ._typing import FrameOrSeries
25
+ from pandas ._typing import FilePathOrBuffer , FrameOrSeries
26
26
from pandas .compat import _get_lzma_file , _import_lzma
27
27
28
28
from pandas .core .dtypes .common import (
@@ -101,7 +101,9 @@ def reset_display_options():
101
101
pd .reset_option ("^display." , silent = True )
102
102
103
103
104
- def round_trip_pickle (obj : FrameOrSeries , path : Optional [str ] = None ) -> FrameOrSeries :
104
+ def round_trip_pickle (
105
+ obj : FrameOrSeries , path : FilePathOrBuffer = None
106
+ ) -> FrameOrSeries :
105
107
"""
106
108
Pickle an object and then read it again.
107
109
You can’t perform that action at this time.
0 commit comments