Skip to content

Commit 818ee65

Browse files
simonjayhawkinsjorisvandenbosschealimcmaster1
authored
Backport Test Only from PR pandas-dev#34500 on branch 1.0.x (REG: Fix read_parquet from file-like objects) (pandas-dev#34787)
Co-authored-by: Joris Van den Bossche <[email protected]> Co-authored-by: alimcmaster1 <[email protected]>
1 parent cdd245c commit 818ee65

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed
2.11 KB
Binary file not shown.

pandas/tests/io/test_parquet.py

+18
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
""" test parquet compat """
22
import datetime
33
from distutils.version import LooseVersion
4+
from io import BytesIO
45
import locale
56
import os
67
from warnings import catch_warnings
@@ -494,6 +495,23 @@ def test_s3_roundtrip(self, df_compat, s3_resource, pa):
494495
# GH #19134
495496
check_round_trip(df_compat, pa, path="s3://pandas-test/pyarrow.parquet")
496497

498+
@tm.network
499+
@td.skip_if_no("pyarrow")
500+
def test_parquet_read_from_url(self, df_compat):
501+
url = (
502+
"https://raw.githubusercontent.com/pandas-dev/pandas/"
503+
"master/pandas/tests/io/data/parquet/simple.parquet"
504+
)
505+
df = pd.read_parquet(url)
506+
tm.assert_frame_equal(df, df_compat)
507+
508+
@td.skip_if_no("pyarrow")
509+
def test_read_file_like_obj_support(self, df_compat):
510+
buffer = BytesIO()
511+
df_compat.to_parquet(buffer)
512+
df_from_buf = pd.read_parquet(buffer)
513+
tm.assert_frame_equal(df_compat, df_from_buf)
514+
497515
def test_partition_cols_supported(self, pa, df_full):
498516
# GH #23283
499517
partition_cols = ["bool", "int"]

0 commit comments

Comments
 (0)