Skip to content

Commit 4aceb7e

Browse files
committed
add filepath stringification
1 parent f238f9b commit 4aceb7e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pandas/io/parquet.py

+5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from warnings import catch_warnings
44
from pandas import DataFrame, RangeIndex, Int64Index, get_option
55
from pandas.compat import range
6+
from pandas.io.common import get_filepath_or_buffer
67

78

89
def get_engine(engine):
@@ -38,11 +39,13 @@ def __init__(self):
3839
self.api = pyarrow
3940

4041
def write(self, df, path, compression=None, **kwargs):
42+
path, _, _ = get_filepath_or_buffer(path)
4143
table = self.api.Table.from_pandas(df)
4244
self.api.parquet.write_table(
4345
table, path, compression=compression, **kwargs)
4446

4547
def read(self, path):
48+
path, _, _ = get_filepath_or_buffer(path)
4649
return self.api.parquet.read_table(path).to_pandas()
4750

4851

@@ -66,11 +69,13 @@ def write(self, df, path, compression=None, **kwargs):
6669
# thriftpy/protocol/compact.py:339:
6770
# DeprecationWarning: tostring() is deprecated.
6871
# Use tobytes() instead.
72+
path, _, _ = get_filepath_or_buffer(path)
6973
with catch_warnings(record=True):
7074
self.api.write(path, df,
7175
compression=compression, **kwargs)
7276

7377
def read(self, path):
78+
path, _, _ = get_filepath_or_buffer(path)
7479
return self.api.ParquetFile(path).to_pandas()
7580

7681

0 commit comments

Comments
 (0)