qis.get_group_dict¶
- qis.get_group_dict(group_data, index_data=None, group_order=None, total_column=None)[source]¶
map each group label to the tickers belonging to it.
group_datais the house convention for asset-class metadata: a Series indexed by ticker whose values are the group labels. This inverts it into group to tickers, which is the shape the grouped reporting layer consumes.- Parameters:
group_data (Series) – group label per ticker, indexed by ticker
index_data (Index | List[str] | ndarray) – restrict the result to these tickers, and order them accordingly. None uses every ticker in
group_datagroup_order (List[str]) – order of the groups in the result. None orders by first appearance
total_column (str | None) – name of an extra group holding every ticker, for a total row alongside the groups. Must differ from every label in
group_data, even whenindex_dataexcludes that group’s tickers. None adds none
- Returns:
group label to the tickers in it, in
group_order- Raises:
ValueError – if
group_datais not a Series, if it orindex_datacontains nulls, or iftotal_columnmatches an observed group labelTypeError – if
index_datais not an Index, list or array
- Return type: