pdstools.explanations.ExplanationsUtils¶
Attributes¶
Classes¶
dict() -> new empty dictionary |
|
Context related operations such as to filter unique contexts. |
Module Contents¶
- SortBy¶
- DisplayBy¶
- ContributionType¶
- class ContextInfo¶
Bases:
TypedDictdict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s
(key, value) pairs
- dict(iterable) -> new dictionary initialized as if via:
d = {} for k, v in iterable:
d[k] = v
- dict(**kwargs) -> new dictionary initialized with the name=value pairs
in the keyword argument list. For example: dict(one=1, two=2)
- class ContextOperations(aggregate: pdstools.explanations.Aggregate.Aggregate)¶
Bases:
pdstools.utils.namespaces.LazyNamespaceContext related operations such as to filter unique contexts.
- Parameters:
(Aggregate) (aggregate)
aggregate (pdstools.explanations.Aggregate.Aggregate)
- aggregate(Aggregate)¶
- Type:
The aggregate object.
- _df(pl.DataFrame | None)¶
- Type:
DataFrame containing context information.
- initialized(bool)¶
- Type:
Flag indicating if the context operations have been initialized.
- get_context_keys():
Returns the list of context keys from loaded data. Eg. [‘pyChannel’, ‘pyDirection’, …]
- get_df(context_infos=None, with_partition_col=False):
Returns a DataFrame containing unique contexts If with_partition_col is True, includes the partition column. If context_infos is None, returns the full unique contexts, else filtered by the context Eg. with partition column: | pyChannel | pyDirection | … | partition | |-----------|————-|-----|———–| | channel1 | direction1 | … | {“partition”: {“pyChannel”: “channel1”, “pyDirection”: “direction1”}} | | channel1 | direction2 | … | {“partition”: {“pyChannel”: “channel1”, “pyDirection”: “direction2”}} |
- get_list(context_infos=None, with_partition_col=False):
Returns a list[ContextInfo] containing unique contexts If with_partition_col is True, includes the partition column. If context_infos is None, returns the full unique contexts, else filtered by the context Eg. without partition column: [
{“pyChannel”: “channel1”, “pyDirection”: “direction1”, …}, {“pyChannel”: “channel1”, “pyDirection”: “direction2”, …},
]
- get_context_info_str(context_info, sep="-"):
Returns a string representation of a single context information. Eg. channel1-direction1-…
- dependencies = ['polars']¶
- dependency_group = 'explanations'¶
- aggregate¶
- initialized = False¶
- get_df(context_infos: list[ContextInfo] | None = None, with_partition_col: bool = False) polars.DataFrame¶
Get the DataFrame filtered by the provided context information.
- Parameters:
context_infos (list[ContextInfo] | None)
with_partition_col (bool)
- Return type:
polars.DataFrame
- get_list(context_infos: list[ContextInfo] | None = None, with_partition_col: bool = False) list[ContextInfo]¶
Get the list of context information filtered by the provided context information.
- Parameters:
context_infos (list[ContextInfo] | None)
with_partition_col (bool)
- Return type:
- static get_context_info_str(context_info: ContextInfo, sep: str = '-') str¶
- Parameters:
context_info (ContextInfo)
sep (str)
- Return type: