MCPcopy
hub / github.com/pandas-dev/pandas / read

Method read

pandas/io/parquet.py:240–286  ·  view source on GitHub ↗
(
        self,
        path,
        columns=None,
        filters=None,
        dtype_backend: DtypeBackend | lib.NoDefault = lib.no_default,
        storage_options: StorageOptions | None = None,
        filesystem=None,
        to_pandas_kwargs: dict[str, Any] | None = None,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

238 handles.close()
239
240 def read(
241 self,
242 path,
243 columns=None,
244 filters=None,
245 dtype_backend: DtypeBackend | lib.NoDefault = lib.no_default,
246 storage_options: StorageOptions | None = None,
247 filesystem=None,
248 to_pandas_kwargs: dict[str, Any] | None = None,
249 **kwargs,
250 ) -> DataFrame:
251 kwargs["use_pandas_metadata"] = True
252
253 path_or_handle, handles, filesystem = _get_path_or_handle(
254 path,
255 filesystem,
256 storage_options=storage_options,
257 mode="rb",
258 )
259 try:
260 pa_table = self.api.parquet.read_table(
261 path_or_handle,
262 columns=columns,
263 filesystem=filesystem,
264 filters=filters,
265 **kwargs,
266 )
267 with catch_warnings():
268 filterwarnings(
269 "ignore",
270 "make_block is deprecated",
271 Pandas4Warning,
272 )
273 result = arrow_table_to_pandas(
274 pa_table,
275 dtype_backend=dtype_backend,
276 to_pandas_kwargs=to_pandas_kwargs,
277 )
278
279 if pa_table.schema.metadata:
280 if b"PANDAS_ATTRS" in pa_table.schema.metadata:
281 df_metadata = pa_table.schema.metadata[b"PANDAS_ATTRS"]
282 result.attrs = json.loads(df_metadata)
283 return result
284 finally:
285 if handles is not None:
286 handles.close()
287
288
289class FastParquetImpl(BaseImpl):

Callers

nothing calls this directly

Calls 4

arrow_table_to_pandasFunction · 0.90
_get_path_or_handleFunction · 0.85
read_tableMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected