Skip to content

Display

Formatting helpers for categorical summary tables.

group_filter()

python
phenofhy.display.group_filter(df, group_col="group", level_col="level",
	variable_col="variable", value_col="value", *, group_order=None,
	variable_order=None, drop_missing_group=False, drop_missing_variable=False)

Filter and order grouped categorical summaries for presentation.

Parameters

  df: pandas.DataFrame
    Categorical summary dataframe.
  group_col: str
    Column name identifying groups.
  level_col: str
    Column name for category level labels.
  variable_col: str
    Column name for variable names.
  value_col: str
    Column name for formatted values.
  group_order: list[str] | None
    Optional explicit ordering of groups.
  variable_order: list[str] | None
    Optional explicit ordering of variables.
  drop_missing_group: bool
    Whether to drop rows with missing group labels.
  drop_missing_variable: bool
    Whether to drop rows with missing variable labels.

Returns

  out: pandas.DataFrame
    Filtered and ordered categorical summary dataframe.

Example

python
from phenofhy import display

panel = display.group_filter(categorical_df)