From e975e4f4a197bfc7f466ec14600f0d4b17d8ae81 Mon Sep 17 00:00:00 2001 From: Pedro Larroy Date: Tue, 21 Apr 2020 13:00:31 -0700 Subject: [PATCH 1/2] Improve to_parquet documentation fixes #29476 --- pandas/core/frame.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 1bff17b40433d..d62798eb1cece 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -2225,6 +2225,16 @@ def to_parquet( col1 col2 0 1 3 1 2 4 + + If you want get a buffer to the parquet content you can use a io.BytesIO object, + as long as you don't use partition_cols, which creates multiple files. + + >>> import io + >>> f = io.BytesIO() + >>> df.to_parquet(f) + >>> f.seek(0) + 0 + >>> content = f.read() """ from pandas.io.parquet import to_parquet From 332943b1339220ab6441e87e86aeaeeb34b2fd9e Mon Sep 17 00:00:00 2001 From: Pedro Larroy Date: Wed, 27 May 2020 18:00:12 -0700 Subject: [PATCH 2/2] Update pandas/core/frame.py Co-authored-by: William Ayd --- pandas/core/frame.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index d62798eb1cece..10382364621c0 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -2226,8 +2226,8 @@ def to_parquet( 0 1 3 1 2 4 - If you want get a buffer to the parquet content you can use a io.BytesIO object, - as long as you don't use partition_cols, which creates multiple files. + If you want to get a buffer to the parquet content you can use a io.BytesIO + object, as long as you don't use partition_cols, which creates multiple files. >>> import io >>> f = io.BytesIO()