@@ -76,9 +76,9 @@ def write(self, df, path, compression='snappy',
76
76
table , path , compression = compression ,
77
77
coerce_timestamps = coerce_timestamps , ** kwargs )
78
78
79
- def read (self , path ):
79
+ def read (self , path , columns = None ):
80
80
path , _ , _ = get_filepath_or_buffer (path )
81
- return self .api .parquet .read_table (path ).to_pandas ()
81
+ return self .api .parquet .read_table (path , columns ).to_pandas ()
82
82
83
83
84
84
class FastParquetImpl (object ):
@@ -115,9 +115,9 @@ def write(self, df, path, compression='snappy', **kwargs):
115
115
self .api .write (path , df ,
116
116
compression = compression , ** kwargs )
117
117
118
- def read (self , path ):
118
+ def read (self , path , columns = None ):
119
119
path , _ , _ = get_filepath_or_buffer (path )
120
- return self .api .ParquetFile (path ).to_pandas ()
120
+ return self .api .ParquetFile (path ).to_pandas (columns )
121
121
122
122
123
123
def to_parquet (df , path , engine = 'auto' , compression = 'snappy' , ** kwargs ):
@@ -178,7 +178,7 @@ def to_parquet(df, path, engine='auto', compression='snappy', **kwargs):
178
178
return impl .write (df , path , compression = compression )
179
179
180
180
181
- def read_parquet (path , engine = 'auto' , ** kwargs ):
181
+ def read_parquet (path , engine = 'auto' , columns = None , ** kwargs ):
182
182
"""
183
183
Load a parquet object from the file path, returning a DataFrame.
184
184
@@ -188,6 +188,8 @@ def read_parquet(path, engine='auto', **kwargs):
188
188
----------
189
189
path : string
190
190
File path
191
+ columns: list
192
+ If not None, only these columns will be read from the file.
191
193
engine : {'auto', 'pyarrow', 'fastparquet'}, default 'auto'
192
194
Parquet reader library to use. If 'auto', then the option
193
195
'io.parquet.engine' is used. If 'auto', then the first
@@ -201,4 +203,4 @@ def read_parquet(path, engine='auto', **kwargs):
201
203
"""
202
204
203
205
impl = get_engine (engine )
204
- return impl .read (path )
206
+ return impl .read (path , columns )
0 commit comments