mlresearch.latex.make_mean_sem_table

mlresearch.latex.make_mean_sem_table(mean_vals, sem_vals=None, make_bold=False, maximum=True, threshold=None, decimals=2, axis=1)[source]

Generate table with rounded decimals, bold maximum/minimum values or values above/below a given threshold, and combine mean and sem values.

Parameters:
mean_valspd.DataFrame

Dataframe with results statistics. Must not contain non-indexed metadata. Supports both single and multi index.

sem_vals{pd.DataFrame or np.ndarray}, default=None

Dataframe with standard errors of the means. If it is a DataFrame, must not contain non-indexed metadata. Supports both single and multi index.

make_boldbool, default=False

If True, make bold the lowest or highest values, or values lower than, or higher than the passed value in threshold per row or column. If False, the parameters maximum, threshold and axis are ignored.

maximumbool, default=True

Whether to look for the highest or lowest values:

  • If True and threshold is None, boldfaces the highest value in each row/column.

  • If False and threshold is None, boldfaces the lowest value in each row/column.

  • If True and threshold is not None, boldfaces all values above the given threshold.

  • If False and threshold is not None, boldfaces all values below the given threshold.

thresholdint or float, default=None

Threshold to boldface values. If None, one value will be boldfaced per row or column. If not None, boldfaces all values above or below threshold.

decimalsint, default=2

Number of decimal places to round each value to.

axis{0 or ‘index’, 1 or ‘columns’}, default=1

Axis along which the function is applied:

  • 0 or ‘index’: apply function to column.

  • 1 or ‘columns’: apply function to each row.

Returns:
scorespd.DataFrame

Dataframe with the specified formatting.