B_HIT.sVDJ.tl.compute_grouped_index#
- B_HIT.sVDJ.tl.compute_grouped_index(_Index_compute, index, groups, column_name, exclude_values=None, exclude_name=None, check_column=None)#
Compute the specified index for each group and handle missing values.
- Parameters:
_Index_compute (pd.DataFrame) – The input DataFrame containing the data.
index (str) – The name of the index to compute (e.g., ‘gini_index’).
groups (list of str) – List of columns to group by (e.g., [‘sample’, ‘Cregion_simple’]).
column_name (str) – The column to apply the index function to (e.g., ‘count’).
exclude_values (list, optional) – List of values to exclude in the result. Default is None.
exclude_name (str, optional) – The name of the column to check for exclusion values. Default is None.
check_column (str, optional) – The name of the column to check for NaN values. If not provided, defaults to the name of the index column.
- Returns:
pd.DataFrame A DataFrame with the computed index for each group.