@@ -3401,6 +3401,7 @@ both on the writing (serialization), and reading (deserialization).
3401
3401
:func: `read_msgpack ` is only guaranteed backwards compatible back to pandas version 0.20.3
3402
3402
3403
3403
.. ipython :: python
3404
+ :okwarning:
3404
3405
3405
3406
df = pd.DataFrame(np.random.rand(5 , 2 ), columns = list (' AB' ))
3406
3407
df.to_msgpack(' foo.msg' )
@@ -3410,20 +3411,23 @@ both on the writing (serialization), and reading (deserialization).
3410
3411
You can pass a list of objects and you will receive them back on deserialization.
3411
3412
3412
3413
.. ipython :: python
3414
+ :okwarning:
3413
3415
3414
3416
pd.to_msgpack(' foo.msg' , df, ' foo' , np.array([1 , 2 , 3 ]), s)
3415
3417
pd.read_msgpack(' foo.msg' )
3416
3418
3417
3419
You can pass ``iterator=True `` to iterate over the unpacked results:
3418
3420
3419
3421
.. ipython :: python
3422
+ :okwarning:
3420
3423
3421
3424
for o in pd.read_msgpack(' foo.msg' , iterator = True ):
3422
3425
print (o)
3423
3426
3424
3427
You can pass ``append=True `` to the writer to append to an existing pack:
3425
3428
3426
3429
.. ipython :: python
3430
+ :okwarning:
3427
3431
3428
3432
df.to_msgpack(' foo.msg' , append = True )
3429
3433
pd.read_msgpack(' foo.msg' )
@@ -3434,6 +3438,7 @@ can pack arbitrary collections of Python lists, dicts, scalars, while intermixin
3434
3438
pandas objects.
3435
3439
3436
3440
.. ipython :: python
3441
+ :okwarning:
3437
3442
3438
3443
pd.to_msgpack(' foo2.msg' , {' dict' : [{' df' : df}, {' string' : ' foo' },
3439
3444
{' scalar' : 1 .}, {' s' : s}]})
@@ -3452,12 +3457,14 @@ Read/write API
3452
3457
Msgpacks can also be read from and written to strings.
3453
3458
3454
3459
.. ipython :: python
3460
+ :okwarning:
3455
3461
3456
3462
df.to_msgpack()
3457
3463
3458
3464
Furthermore you can concatenate the strings to produce a list of the original objects.
3459
3465
3460
3466
.. ipython :: python
3467
+ :okwarning:
3461
3468
3462
3469
pd.read_msgpack(df.to_msgpack() + s.to_msgpack())
3463
3470
0 commit comments