@@ -76,9 +76,9 @@ def write(self, df, path, compression='snappy',
7676 table , path , compression = compression ,
7777 coerce_timestamps = coerce_timestamps , ** kwargs )
7878
79- def read (self , path ):
79+ def read (self , path , columns = None ):
8080 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 = columns ).to_pandas ()
8282
8383
8484class FastParquetImpl (object ):
@@ -115,9 +115,9 @@ def write(self, df, path, compression='snappy', **kwargs):
115115 self .api .write (path , df ,
116116 compression = compression , ** kwargs )
117117
118- def read (self , path ):
118+ def read (self , path , columns = None ):
119119 path , _ , _ = get_filepath_or_buffer (path )
120- return self .api .ParquetFile (path ).to_pandas ()
120+ return self .api .ParquetFile (path ).to_pandas (columns = columns )
121121
122122
123123def to_parquet (df , path , engine = 'auto' , compression = 'snappy' , ** kwargs ):
@@ -178,7 +178,7 @@ def to_parquet(df, path, engine='auto', compression='snappy', **kwargs):
178178 return impl .write (df , path , compression = compression )
179179
180180
181- def read_parquet (path , engine = 'auto' , ** kwargs ):
181+ def read_parquet (path , engine = 'auto' , columns = None , ** kwargs ):
182182 """
183183 Load a parquet object from the file path, returning a DataFrame.
184184
@@ -188,6 +188,10 @@ def read_parquet(path, engine='auto', **kwargs):
188188 ----------
189189 path : string
190190 File path
191+ columns: list, default=None
192+ If not None, only these columns will be read from the file.
193+
194+ .. versionadded 0.21.1
191195 engine : {'auto', 'pyarrow', 'fastparquet'}, default 'auto'
192196 Parquet reader library to use. If 'auto', then the option
193197 'io.parquet.engine' is used. If 'auto', then the first
@@ -201,4 +205,4 @@ def read_parquet(path, engine='auto', **kwargs):
201205 """
202206
203207 impl = get_engine (engine )
204- return impl .read (path )
208+ return impl .read (path , columns = columns )
0 commit comments