format_grouped_series_as_multi_column_grid

Documentation for eth_defi.research.value_table.format_grouped_series_as_multi_column_grid function.

format_grouped_series_as_multi_column_grid(groups, n_cols=2, multi_col_threshold=5, metric_col_width=160, value_col_width=100)

Render grouped key-value data as multi-column tables with bold headings.

Each group becomes its own Metric | Value grid section preceded by a bold heading row spanning all columns. Column headers are hidden, values are right-aligned, and vertical borders separate column pairs.

All columns use fixed pixel widths so that single-column and multi-column sections align consistently.

Sections with multi_col_threshold or fewer items are rendered as a single column (one Metric/Value pair per row). Larger sections use n_cols columns.

Parameters
  • groups (list[tuple[str, pandas.Series]]) – List of (heading, series) tuples. Each heading is rendered as a bold row above the corresponding grid section.

  • n_cols (int) – Number of metric/value pairs per row for large sections.

  • multi_col_threshold (int) – Sections with more items than this use n_cols columns; smaller sections use a single column.

  • metric_col_width (int) – Fixed width in pixels for metric name columns.

  • value_col_width (int) – Fixed width in pixels for value columns.

Returns

HTML string containing all sections.

Return type

str