mlresearch.latex.format_table

mlresearch.latex.format_table(table, indices=None, columns=None, drop_missing=True)[source]

Sort and rename rows and columns. Mostly used to set results from experiments in the intended order.

Parameters:
tablepd.DataFrame

Dataframe with results statistics. Optionally, it may be indexed with related metadata. Supports both single and multi index.

indiceslist, dict

Iterable with index names and order of index. Can be used to order index columns, rows and filter unwanted rows or columns:

  • If list of strings, orders index according to the passed values.

  • If list of lists, orders multi indices according to the passed values.

  • If list of dicts, orders and renames indices according to the passed values.

  • If dict, orders and renames index values.

  • If dict of lists orders index columns and values.

  • If dict of dicts orders both index columns and values and renames values.

columnslist, dict

Iterable with column names and order of columns. Can be used to order columns, filter unwanted columns:

  • If list, orders and selects columns

  • If dict, orders, selects and renames columns

drop_missingbool, default=True

If True, removes any values, columns or indices not included in indices and columns. If False, the columns and indices not included will be moved to the end of the dataframe.

Returns:
formatted_tablepd.DataFrame

Formatted dataframe.