Skip to content

Commit 20a854d

Browse files
committed
Added ref for protocol parameter + edited whatsnew.
1 parent 14bc485 commit 20a854d

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

doc/source/whatsnew/v0.21.0.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ New features
2727
Other Enhancements
2828
^^^^^^^^^^^^^^^^^^
2929

30-
- Added protocol parameter to :func:`to_pickle`. The 'protocol' parameter defaults to HIGHEST_PROTOCOL. (:issue:`16252`)
30+
- :func:`to_pickle` has gained a protocol parameter (:issue:`16252`). By default,
31+
this parameter is set to HIGHEST_PROTOCOL (see https://docs.python.org/3/library/pickle.html, 12.1.2).
3132

3233
.. _whatsnew_0210.api_breaking:
3334

pandas/core/generic.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -1359,13 +1359,14 @@ def to_pickle(self, path, compression='infer',
13591359
.. versionadded:: 0.20.0
13601360
protocol : int
13611361
Int which indicates which protocol should be used by the pickler,
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.A negative value for the
1366-
protocol parameter is equivalent to setting its value to
1362+
default HIGHEST_PROTOCOL (see [1], paragraph 12.1.2). The possible
1363+
values for this parameter depend on the version of Python. For
1364+
Python 2.x, possible values are 0, 1, 2. For Python>=3.0, 3 is a
1365+
valid value. For Python >= 3.4, 4 is a valid value.A negative value
1366+
for the protocol parameter is equivalent to setting its value to
13671367
HIGHEST_PROTOCOL.
13681368
1369+
.. [1] https://docs.python.org/3/library/pickle.html
13691370
.. versionadded:: 0.21.0
13701371
13711372
"""

pandas/io/pickle.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ def to_pickle(obj, path, compression='infer', protocol=pkl.HIGHEST_PROTOCOL):
2222
.. versionadded:: 0.20.0
2323
protocol : int
2424
Int which indicates which protocol should be used by the pickler,
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.
25+
default HIGHEST_PROTOCOL (see [1], paragraph 12.1.2). The possible
26+
values for this parameter depend on the version of Python. For Python
27+
2.x, possible values are 0, 1, 2. For Python>=3.0, 3 is a valid value.
2828
For Python >= 3.4, 4 is a valid value. A negative value for the
2929
protocol parameter is equivalent to setting its value to
3030
HIGHEST_PROTOCOL.
3131
32+
.. [1] https://docs.python.org/3/library/pickle.html
3233
.. versionadded:: 0.21.0
3334
3435

0 commit comments

Comments
 (0)