Skip to content

Commit

Permalink
only need .api
Browse files Browse the repository at this point in the history
  • Loading branch information
jreback committed Mar 29, 2017
1 parent a0e4076 commit 9662db7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pandas/io/parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,22 @@ def __init__(self):

try:
import pyarrow
from pyarrow import parquet
import pyarrow.parquet
except ImportError:
raise ImportError("pyarrow is required for parquet support\n\n"
"you can install via conda\n"
"conda install pyarrow -c conda-forge\n"
"\nor via pip\n"
"pip install pyarrow\n")
self.api = pyarrow
self.parquet = parquet

def write(self, df, path, compression=None, **kwargs):
table = self.api.Table.from_pandas(df)
self.parquet.write_table(
self.api.parquet.write_table(
table, path, compression=compression, **kwargs)

def read(self, path):
return self.parquet.read_table(path).to_pandas()
return self.api.parquet.read_table(path).to_pandas()


class FastParquetImpl(object):
Expand Down

0 comments on commit 9662db7

Please sign in to comment.