Skip to content

hbsir.calculate.add_quantile

Adds quantiles as a column to the input table.

Parameters:

Name Type Description Default
table DataFrame | Series

Table to add quantiles to.

None
bins int

Number of quantile bins to create.

-1
on_variable _QuantileBase

Variable to calculate quantiles on.

None
on_column str

Column to calculate quantiles on.

None

Other Parameters:

Name Type Description
quantile_column_name str

Name for added quantile column.

weight_column str

Column name to use for weighting rows.

weighted bool

Whether to calculate weighted quantiles.

adjust_weight_for_household_size bool

Adjust weights for household size.

equivalence_scale _EquivalenceScale

Household equivalence scale to use.

for_all bool

Calculate quantiles across all rows.

annual bool

Annualize quantiles.

groupby str | list[str]

Column(s) to group by.

years list[int]

Years to include.

Returns:

Type Description
DataFrame

Input table with added quantile column.