numeraire.core.sorts.assign_portfolio_bins#
- numeraire.core.sorts.assign_portfolio_bins(signal: DataFrame, *, n_bins: int = 10, breakpoint_universe: DataFrame | None = None, eligibility: DataFrame | None = None) SortAssignments[source]#
Freeze formation-time portfolio memberships without consulting realized returns.
signalis(date x asset).eligibilityoptionally restricts which assets may be assigned; missing mask entries mean ineligible.breakpoint_universeoptionally restricts which eligible signals define the cutoffs, while the cutoffs are still applied to all eligible assets. Both masks are aligned tosignalby pandas labels, so their input order is irrelevant.Every date must have at least
n_binsfinite, eligible breakpoint observations and at leastn_binsdistinct signal values, and its empirical quantiles must populate every requested bin. An empty, thin, or tie-degenerate breakpoint universe raises rather than silently switching to all-name breakpoints or emitting collapsed portfolios.