diff --git a/pandas/io/pickle.py b/pandas/io/pickle.py index 2928d8c6520b0..373d608876c3e 100644 --- a/pandas/io/pickle.py +++ b/pandas/io/pickle.py @@ -160,11 +160,14 @@ def read_pickle( Notes ----- - read_pickle is only guaranteed to be backwards compatible to pandas 0.20.3. + read_pickle is only guaranteed to be backwards compatible to pandas 0.20.3 + provided the object was serialized with to_pickle. Examples -------- - >>> original_df = pd.DataFrame({{"foo": range(5), "bar": range(5, 10)}}) # doctest: +SKIP + >>> original_df = pd.DataFrame( + ... {{"foo": range(5), "bar": range(5, 10)}} + ... ) # doctest: +SKIP >>> original_df # doctest: +SKIP foo bar 0 0 5 @@ -182,7 +185,7 @@ def read_pickle( 2 2 7 3 3 8 4 4 9 - """ # noqa: E501 + """ excs_to_catch = (AttributeError, ImportError, ModuleNotFoundError, TypeError) with get_handle( filepath_or_buffer,