call_report.fca.reader.read_schedule_file#

call_report.fca.reader.read_schedule_file(*, data_path: Path, layout: FCALayout, dataframe_type: None = None) NativeDataFrame[source]#
call_report.fca.reader.read_schedule_file(*, data_path: Path, layout: FCALayout, dataframe_type: Literal['pandas']) pandas.DataFrame
call_report.fca.reader.read_schedule_file(*, data_path: Path, layout: FCALayout, dataframe_type: Literal['pyarrow_table']) pyarrow.Table
call_report.fca.reader.read_schedule_file(*, data_path: Path, layout: FCALayout, dataframe_type: Literal['polars_dataframe']) polars.DataFrame
call_report.fca.reader.read_schedule_file(*, data_path: Path, layout: FCALayout, dataframe_type: Literal['polars_lazyframe']) polars.LazyFrame

Parse a schedule’s data file into a tidy native dataframe.

The row shape depends on layout’s scenario. A "single" layout produces one row per institution. The two multi-occurrence scenarios produce one row per (institution, reported code), with the code itself taken from the data rather than assumed from a fixed count.

Parameters:
data_pathpathlib.Path

Path to the raw, comma-delimited data file.

layoutFCALayout

The layout describing data_path’s columns, as returned by call_report.fca.layout.parse_layout.

dataframe_type{“pandas”, “pyarrow_table”, “polars_lazyframe”, “polars_dataframe”}, optional

The dataframe type to convert the result to as a final step. Leave this None (the default) to get back whatever backend call_report.config.get_config currently has configured. Set it when the code that consumes this result needs a specific type, for example a pandas DataFrame while the package is configured to use polars.

Returns:
NativeDataFrame

A native dataframe of the configured backend, or of dataframe_type if it was supplied.

Raises:
LayoutParseError

If a row’s field count cannot be reconciled with layout.