diff --git a/pandas/io/parquet.py b/pandas/io/parquet.py index a9c7b15ed6a881..e6e601c8d06301 100644 --- a/pandas/io/parquet.py +++ b/pandas/io/parquet.py @@ -3,6 +3,7 @@ from warnings import catch_warnings from pandas import DataFrame, RangeIndex, Int64Index, get_option from pandas.compat import range +from pandas.io.common import get_filepath_or_buffer def get_engine(engine): @@ -38,11 +39,13 @@ def __init__(self): self.api = pyarrow def write(self, df, path, compression=None, **kwargs): + path, _, _ = get_filepath_or_buffer(path) table = self.api.Table.from_pandas(df) self.api.parquet.write_table( table, path, compression=compression, **kwargs) def read(self, path): + path, _, _ = get_filepath_or_buffer(path) return self.api.parquet.read_table(path).to_pandas() @@ -66,11 +69,13 @@ def write(self, df, path, compression=None, **kwargs): # thriftpy/protocol/compact.py:339: # DeprecationWarning: tostring() is deprecated. # Use tobytes() instead. + path, _, _ = get_filepath_or_buffer(path) with catch_warnings(record=True): self.api.write(path, df, compression=compression, **kwargs) def read(self, path): + path, _, _ = get_filepath_or_buffer(path) return self.api.ParquetFile(path).to_pandas()