skfolio/skfolio-panel-inactive-policy
| Pack | Severity | Fix | Versions |
|---|---|---|---|
| skfolio | error | unsafe, with xpd check --fix --unsafe-fixes |
skfolio 1.14.4+ |
skfolio AssetPanel distinguishes inactive pairs from missing values for active assets. Its field policy controls what values are valid outside active_mask.
FieldCategorical(values=codes, levels=labels, inactive_policy=InactivePolicy.ZERO)FieldCategorical(values=codes, levels=labels, inactive_policy=InactivePolicy.MISSING)What the rule reports
Section titled “What the rule reports”Reserve -1 for missing categorical codes. For numeric fields, use NaN under MISSING, explicitly construct a field with ZERO when zero is meaningful, or use IGNORE when intentionally retaining inactive values. CharacteristicsFactorModel expects the panel as its characteristics input.
How to fix it
Section titled “How to fix it”Use xpd check --fix --unsafe-fixes to switch InactivePolicy.ZERO on FieldCategorical to InactivePolicy.MISSING and to convert string inactive_policy values to InactivePolicy enum members.
Diagnostic message
Section titled “Diagnostic message”skfolio FieldCategorical raises ValueError for InactivePolicy.ZERO because code 0 is a category. Use MISSING and encode inactive entries as -1.See all rules in the skfolio pack.