50
50
from pandas .compat .numpy import function as nv
51
51
from pandas .compat import (map , zip , lzip , lrange , string_types ,
52
52
isidentifier , set_function_name )
53
+ from pandas .compat import cPickle as pkl
53
54
import pandas .core .nanops as nanops
54
55
from pandas .util .decorators import Appender , Substitution , deprecate_kwarg
55
56
from pandas .util .validators import validate_bool_kwarg
@@ -1344,7 +1345,8 @@ def to_sql(self, name, con, flavor=None, schema=None, if_exists='fail',
1344
1345
if_exists = if_exists , index = index , index_label = index_label ,
1345
1346
chunksize = chunksize , dtype = dtype )
1346
1347
1347
- def to_pickle (self , path , compression = 'infer' ):
1348
+ def to_pickle (self , path , compression = 'infer' ,
1349
+ protocol = pkl .HIGHEST_PROTOCOL ):
1348
1350
"""
1349
1351
Pickle (serialize) object to input file path.
1350
1352
@@ -1354,11 +1356,15 @@ def to_pickle(self, path, compression='infer'):
1354
1356
File path
1355
1357
compression : {'infer', 'gzip', 'bz2', 'xz', None}, default 'infer'
1356
1358
a string representing the compression to use in the output file
1359
+ protocol : int
1360
+ Int which indicates which protocol should be used by the pickler,
1361
+ default HIGHEST_PROTOCOL (Pickle module).
1357
1362
1358
1363
.. versionadded:: 0.20.0
1359
1364
"""
1360
1365
from pandas .io .pickle import to_pickle
1361
- return to_pickle (self , path , compression = compression )
1366
+ return to_pickle (self , path , compression = compression ,
1367
+ protocol = protocol )
1362
1368
1363
1369
def to_clipboard (self , excel = None , sep = None , ** kwargs ):
1364
1370
"""
0 commit comments