Skip to content

Commit 04bc5c2

Browse files
committed
Added 'versionadded' tag, improved docstring + fixed import.
1 parent 66a35e8 commit 04bc5c2

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

pandas/core/generic.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@
4949
from pandas import compat
5050
from pandas.compat.numpy import function as nv
5151
from pandas.compat import (map, zip, lzip, lrange, string_types,
52-
isidentifier, set_function_name)
53-
from pandas.compat import cPickle as pkl
52+
isidentifier, set_function_name, cPickle as pkl)
5453
import pandas.core.nanops as nanops
5554
from pandas.util.decorators import Appender, Substitution, deprecate_kwarg
5655
from pandas.util.validators import validate_bool_kwarg
@@ -1356,11 +1355,17 @@ def to_pickle(self, path, compression='infer',
13561355
File path
13571356
compression : {'infer', 'gzip', 'bz2', 'xz', None}, default 'infer'
13581357
a string representing the compression to use in the output file
1358+
1359+
.. versionadded:: 0.20.0
13591360
protocol : int
13601361
Int which indicates which protocol should be used by the pickler,
1361-
default HIGHEST_PROTOCOL (Pickle module).
1362+
default HIGHEST_PROTOCOL (Pickle module). The possible values for
1363+
this parameter depend on the version of Python. For Python 2.x,
1364+
possible values are 0, 1, 2. For Python>=3.0, 3 is a valid value.
1365+
For Python >= 3.4, 4 is a valid value.
1366+
1367+
.. versionadded:: 0.21.0
13621368
1363-
.. versionadded:: 0.20.0
13641369
"""
13651370
from pandas.io.pickle import to_pickle
13661371
return to_pickle(self, path, compression=compression,

pandas/io/pickle.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,18 @@ def to_pickle(obj, path, compression='infer', protocol=pkl.HIGHEST_PROTOCOL):
1818
File path
1919
compression : {'infer', 'gzip', 'bz2', 'xz', None}, default 'infer'
2020
a string representing the compression to use in the output file
21+
22+
.. versionadded:: 0.20.0
2123
protocol : int
2224
Int which indicates which protocol should be used by the pickler,
23-
default HIGHEST_PROTOCOL (Pickle module).
25+
default HIGHEST_PROTOCOL (Pickle module). The possible values for
26+
this parameter depend on the version of Python. For Python 2.x,
27+
possible values are 0, 1, 2. For Python>=3.0, 3 is a valid value.
28+
For Python >= 3.4, 4 is a valid value.
29+
30+
.. versionadded:: 0.21.0
31+
2432
25-
.. versionadded:: 0.20.0
2633
"""
2734
inferred_compression = _infer_compression(path, compression)
2835
f, fh = _get_handle(path, 'wb',

0 commit comments

Comments
 (0)