Skip to content

Commit 9c9d38f

Browse files
committed
Added enhancement to 'whatsnew' file.
1 parent 35f8d18 commit 9c9d38f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

doc/source/whatsnew/v0.21.0.txt

+22
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,28 @@ New features
2727
Other Enhancements
2828
^^^^^^^^^^^^^^^^^^
2929

30+
Pickle file I/O protocol parameter
31+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
32+
33+
:func:`to_pickle` now allows to specify the protocol used by the Pickler.
34+
The 'protocol' parameter defaults to HIGHEST_PROTOCOL. For Python 2.x, HIGHEST_PROTOCOL is 2.
35+
Since Python 3.0 (respectively 3.4), HIGHEST_PROTOCOL is 3 (respectively 4).
36+
A negative value for the protocol parameter is equivalent to setting its value to HIGHEST_PROTOCOL.
37+
38+
.. ipython:: python
39+
40+
df = pd.DataFrame({
41+
'A': np.random.randn(1000),
42+
'B': 'foo',
43+
'C': pd.date_range('20130101', periods=1000, freq='s')})
44+
45+
Using an explicit protocol parameter
46+
47+
.. ipython:: python
48+
49+
df.to_pickle("data.pkl", protocol=2)
50+
rt = pd.read_pickle("data.pkl")
51+
rt
3052

3153

3254
.. _whatsnew_0210.api_breaking:

0 commit comments

Comments
 (0)