call_report.fca.get_domain_dataset_codes#
- call_report.fca.get_domain_dataset_codes(*, domain_dataset: FCADomainDataset | str, dataframe_type: None = None) NativeDataFrame[source]#
- call_report.fca.get_domain_dataset_codes(*, domain_dataset: FCADomainDataset | str, dataframe_type: Literal['pandas']) pandas.DataFrame
- call_report.fca.get_domain_dataset_codes(*, domain_dataset: FCADomainDataset | str, dataframe_type: Literal['pyarrow_table']) pyarrow.Table
- call_report.fca.get_domain_dataset_codes(*, domain_dataset: FCADomainDataset | str, dataframe_type: Literal['polars_dataframe']) polars.DataFrame
- call_report.fca.get_domain_dataset_codes(*, domain_dataset: FCADomainDataset | str, dataframe_type: Literal['polars_lazyframe']) polars.LazyFrame
Return a curated domain dataset’s codes and what each one means.
The reshaped frame keys its rows by code, so this is the lookup that turns those codes into names.
is_totalmarks a code the source reports as a subtotal, which a caller aggregating over codes has to exclude.- Parameters:
- domain_datasetFCADomainDataset or str
The domain dataset to look up. A string is matched case-insensitively.
- 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.
- Returns:
- NativeDataFrame
Columns
code,label, andis_total, one row per code, of the configured backend or of dataframe_type if it was supplied.
- Raises:
- DomainDatasetNotFoundError
If domain_dataset does not name a shipped dataset.
Examples
>>> from call_report.fca import get_domain_dataset_codes >>> codes = get_domain_dataset_codes(domain_dataset="loan_portfolio") >>> codes.shape (13, 3) >>> row = codes[codes["code"] == 110].iloc[0] >>> row["label"], bool(row["is_total"]) ('Agribusiness', False)