bayesline.api.equity.UploadParserApi#
- class bayesline.api.equity.UploadParserApi#
Bases:
ABC
Methods
__init__
()can_handle
(raw_df, *[, name])Parameters raw_df: pl.DataFrame The dataframe to check if the parser can handle. name: str | None, optional The name of the dataframe (which could be the filename). Some parsers might extract information (such as a date) from the name.
Returns list[pl.DataFrame]: A list of example portfolios that can be used to test the parser.
Returns dict[str, pl.DataType]: The schema that this parser produces.
parse
(raw_df, *[, name])Parameters raw_df: pl.DataFrame The dataframe to parse. name: str | None, optional The name of the dataframe (which could be the filename). Some parsers might extract information (such as a date) from the name.
Attributes
- abstract output_schema() dict[str, DataType] #
Returns#
- dict[str, pl.DataType]:
The schema that this parser produces.
- abstract get_examples() list[DataFrame] #
Returns#
- list[pl.DataFrame]:
A list of example portfolios that can be used to test the parser.
- abstract can_handle(raw_df: DataFrame, *, name: str | None = None) UploadParserResult #
Parameters#
- raw_df: pl.DataFrame
The dataframe to check if the parser can handle.
- name: str | None, optional
The name of the dataframe (which could be the filename). Some parsers might extract information (such as a date) from the name.
Returns#
UploadParserResult
- abstract parse(raw_df: DataFrame, *, name: str | None = None) tuple[DataFrame, UploadParserResult] #
Parameters#
- raw_df: pl.DataFrame
The dataframe to parse.
- name: str | None, optional
The name of the dataframe (which could be the filename). Some parsers might extract information (such as a date) from the name.
Returns#
- tuple[pl.DataFrame, UploadParserResult]:
A tuple of the parsed pl.DataFrame and a UploadParserResult. If the parser was unsuccessful the parsed dataframe will instead be a (possibly empty) error dataframe.