Skip to content

hbsir.calculate.average_table

Calculates the weighted average of the given columns for each group.

Parameters:

Name Type Description Default
table DataFrame

The table to calculate the weighted average for.

required
weight_col str | None

The column to use as the weight, by default None

None
groupby list[str] | None

The columns to group by, by default None

None
columns list[str] | None

The columns to calculate the weighted average for, by default None

None

Returns:

Type Description
DataFrame

The weighted average of the given columns for each group.