arch/reindex-is-default
| Pack | Severity | Fix | Versions |
|---|---|---|---|
| arch | info | safe, with xpd check --fix |
arch 6.2+ |
reindex=False has been the default of forecast since arch 6.2, so the argument does nothing. Drop it.
res = arch_model(returns).fit(disp="off")forecasts = res.forecast(horizon=5, reindex=False)forecasts = res.forecast(horizon=5)What the rule reports
Section titled “What the rule reports”The rule reports reindex=False given to forecast of an arch model or result.
The rule follows arch_model and arch mean constructors, along with results from their fit or fix calls. Any intermediate name must be assigned exclusively from one of those calls.
How to fix it
Section titled “How to fix it”xpd check --fix applies the fix of this rule.
With the safe fix, the argument is taken out. When it is the first argument or follows a comment, the fix writes the arguments again without it and drops the comments between them.
Before arch 6.2, forecast returned a frame as long as the data and warned that the default
would change. Code from before 6.2 passes reindex=False to get the short frame without the
warning, and the document carries since: "6.2".
| arch | forecast() on 1,500 rows |
forecast(reindex=False) |
|---|---|---|
| 6.1.0 | 1,500 rows and a FutureWarning | the short frame, without the warning |
| 6.2.0, 8.0.0, 9.0.0 | 1 row and no warning | the same frame as forecast(), for the last row and with start |
The fix is safe, because the two frames were equal on 6.2.0, 8.0.0 and 9.0.0. reindex=True
still returns the long frame and is left alone.
The import from arch.__future__ import reindexing comes from the same habit and is reported by
removed-in-arch. The rule made 61 reports on the public code, and 20 on
arch's own tests, notebooks and documentation.
Diagnostic message
Section titled “Diagnostic message”reindex=False is the default of forecast since arch 6.2, so this argument does nothing. Drop it.See all rules in the arch pack.