Skip to content

Commit

Permalink
warnings in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jreback committed Jun 28, 2019
1 parent 1517507 commit 5bcc589
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions doc/source/user_guide/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3401,6 +3401,7 @@ both on the writing (serialization), and reading (deserialization).
:func:`read_msgpack` is only guaranteed backwards compatible back to pandas version 0.20.3

.. ipython:: python
:okwarning:
df = pd.DataFrame(np.random.rand(5, 2), columns=list('AB'))
df.to_msgpack('foo.msg')
Expand All @@ -3410,20 +3411,23 @@ both on the writing (serialization), and reading (deserialization).
You can pass a list of objects and you will receive them back on deserialization.

.. ipython:: python
:okwarning:
pd.to_msgpack('foo.msg', df, 'foo', np.array([1, 2, 3]), s)
pd.read_msgpack('foo.msg')
You can pass ``iterator=True`` to iterate over the unpacked results:

.. ipython:: python
:okwarning:
for o in pd.read_msgpack('foo.msg', iterator=True):
print(o)
You can pass ``append=True`` to the writer to append to an existing pack:

.. ipython:: python
:okwarning:
df.to_msgpack('foo.msg', append=True)
pd.read_msgpack('foo.msg')
Expand All @@ -3434,6 +3438,7 @@ can pack arbitrary collections of Python lists, dicts, scalars, while intermixin
pandas objects.

.. ipython:: python
:okwarning:
pd.to_msgpack('foo2.msg', {'dict': [{'df': df}, {'string': 'foo'},
{'scalar': 1.}, {'s': s}]})
Expand All @@ -3452,12 +3457,14 @@ Read/write API
Msgpacks can also be read from and written to strings.

.. ipython:: python
:okwarning:
df.to_msgpack()
Furthermore you can concatenate the strings to produce a list of the original objects.

.. ipython:: python
:okwarning:
pd.read_msgpack(df.to_msgpack() + s.to_msgpack())
Expand Down
2 changes: 2 additions & 0 deletions doc/source/whatsnew/v0.13.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,7 @@ Experimental
Since this is an EXPERIMENTAL LIBRARY, the storage format may not be stable until a future release.

.. ipython:: python
:okwarning:
df = pd.DataFrame(np.random.rand(5, 2), columns=list('AB'))
df.to_msgpack('foo.msg')
Expand All @@ -841,6 +842,7 @@ Experimental
You can pass ``iterator=True`` to iterator over the unpacked results

.. ipython:: python
:okwarning:
for o in pd.read_msgpack('foo.msg', iterator=True):
print(o)
Expand Down

0 comments on commit 5bcc589

Please sign in to comment.