qis.split_df_by_groups¶
- qis.split_df_by_groups(df, group_data, total_column=None, group_order=None)[source]¶
split a panel’s columns into one frame per group.
The frame is time by asset and
group_datamaps asset to group, so this returns one time-by-asset frame per group. Groups with no columns present indfare omitted rather than returned empty.- Parameters:
df (DataFrame) – panel indexed by date with one column per asset
group_data (Series) – group label per asset, indexed by asset
total_column (str | None) – name of an extra group holding every classified column. Must differ from the labels in
group_data. None adds nonegroup_order (List[str]) – order of the groups. None orders by first appearance
- Returns:
group label to the sub-panel of
df, each a copy rather than a view- Raises:
ValueError – if
total_columnmatches a label ingroup_data- Return type: