Repository navigation
MAINT: Remove Deprecations and outdated code - #10015
Merged
Merged
Conversation
The `y` alias for `endog` was deprecated with remove_version="0.11.0" via deprecated_alias(); that version shipped years ago, so drop it.
…ault The scalar=None deprecation path promised this default switch after 0.14 was released; 0.14 has long since shipped, so scalar now defaults to True and the legacy array-returning warning is gone.
cols was deprecated in 0.13 for removal after 0.14 since it only works with NumPy array inputs; slice the returned confidence interval array instead. Updated the base implementation and its overrides in discrete, regression, rolling, multivariate, and GEE results classes.
categorical() has raised NotImplementedError unconditionally for years in favor of pandas.get_dummies; drop the dead stub and its exports from statsmodels.tools and statsmodels.api.
use_boxcox, use_basinhopping, initial_level, and initial_trend were deprecated on fit() since 0.12 in favor of setting them at model construction; they already raised on any non-None value, so drop the parameters entirely from ExponentialSmoothing, Holt, and SimpleExpSmoothing fit() methods.
Drop the damped/smoothing_slope/initial_slope/damping_slope deprecate_kwarg shims in favor of damped_trend/smoothing_trend/ initial_trend/damping_trend; these renames predate statsmodels 0.12.
Both were deprecated in 0.14.0 on SimulationSmoother.simulate() in favor of the split measurement/state variants; drop the parameters and the tests that only existed to exercise them.
Both were deprecated in 0.14.0 in favor of value/y_grid and already raised TypeError unconditionally; drop the dead parameters from test_poisson_2indep and etest_poisson_2indep.
Both functions were deprecated in 0.14 in favor of the versions moved to discrete._diagnostics_count and have raised NotImplementedError unconditionally since; no code calls them.
linear was deprecated in 0.14 in favor of which="linear" across discrete models' predict()/get_prediction() and GLM.predict(); the GLMResults.get_prediction() linear argument was already unused dead code. Drop the parameter everywhere, update the one internal call site and test that still passed it, and remove the now-pointless warning filter in outliers_influence.
The deviance-based bic was deprecated with a plan to switch to the log-likelihood formula after 0.13; that version has long shipped, so drop the SET_USE_BIC_LLF module-global toggle and its FutureWarning. bic is now always bic_llf; bic_deviance remains available separately.
tsa.arma_mle.Arma has done nothing but raise NotImplementedError since ARMA was removed in 0.14, and it was not part of the public API. Its only real subclass, miscmodels.tmodel.TArma, never overrode __init__ so it was permanently unusable and untested; remove both.
…n_dispersion _old was a temporary keyword added during the 0.14 cycle to return the legacy raw-tuple output; no code calls it with _old=True, so drop the parameter and always return the DispersionResults object.
init never had more than one valid (default) choice and was already documented as deprecated with no replacement; drop it and simplify the resulting scale-initialization check.
AR was hard-removed in favor of AutoReg/SARIMAX years ago and no code raises this message anymore; the string was orphaned dead code.
The deprecation warning promised this would raise after release 0.13 in favor of 'adjusted'; drop it from the allowed method options so Python raises directly for the removed value.
Drop the deprecate_kwarg("unbiased", "adjusted") shims on acovf,
pacf_ols, ccovf, ccf, plot_acf, yule_walker, and durbin_levinson;
this rename dates to 2019/2020, well before 0.12.
Drop the deprecate_kwarg shims for cov_kwargs/cov_kwds, maxlag/nlags, results/res, result/res, and olsresults/res across compare_encompassing, acorr_lm, het_arch, acorr_breusch_godfrey, linear_reset, and recursive_olsresiduals; these renames date to 2020.
forecast_years was renamed to forecast_periods in 2019; drop the deprecate_kwarg shim from x13_arima_analysis and x13_arima_select_order.
statsmodels/compat/scipy.py already imports multivariate_t directly from scipy.stats unconditionally (scipy floor is 1.8); this vendored fallback module has had no remaining callers.
The scipy floor is 1.8, so these were always False/True respectively; drop them from statsmodels.compat.scipy and simplify the dead branches that consumed them in test_generic_methods.py and test_copula.py.
The numpy floor is 1.22.3, so this TYPE_CHECKING-only version check could never trigger; numpy.typing is available unconditionally.
pd.RangeIndex.start/stop/step have been public attributes since pandas 0.25, far below the 1.4 floor; drop the private-attribute fallback.
The comment marked this fallback for removal once the pandas minimum reached 1.0.0; the floor is now 1.4, so drop the AttributeError branch.
scipy.integrate.simpson has been available since scipy 1.6, below the 1.8 floor; drop the simps import fallback.
scipy.integrate.trapezoid has been available since scipy 1.6, below the 1.8 floor; drop the trapz import fallback.
scipy.stats.binomtest has been available since scipy 1.7, below the 1.8 floor; drop the binom_test fallbacks in sign_test and the two proportion confidence interval helpers.
scipy.signal._signaltools._centered has been the correct location since scipy 1.8.0, which is the floor; drop the older scipy.signal.signaltools fallback path.
scipy.stats._mvn.mvndst has been the correct private location since scipy 1.8.0, the floor; keep only the newer import and the scipy>=1.16 removal fallback stub.
scipy.optimize.differential_evolution has been available since scipy 0.15.0, far below the 1.8 floor; drop the have_de_optim flag and brute-only fallback path.
is_numeric_dtype (pandas 0.19+), tseries.offsets (pre-1.0), and the pandas.testing module (0.20+) have all been available well below the 1.4 floor; import them unconditionally. Also drops a vestigial TypeAlias try/except whose branches were identical.
pandas.api.types.is_extension_array_dtype has existed since the extension-array API landed in pandas 0.23, well below the 1.4 floor; import it unconditionally at module load instead of guarding inline.
is_monotonic_increasing and Series.items() have both been available since long before pandas 1.5 (predating the deprecation of their older is_monotonic/iteritems counterparts), so these AttributeError fallbacks were already unreachable at the 1.4 floor.
Follow-up to the GLM bic_llf default change: CheckGLMConstrainedMixin compared res1.bic against a Stata reference that is deviance-based (per its own comment), so compare against bic_deviance instead now that bic returns the log-likelihood version by default.
| def conf_int(self, alpha=0.05, cols=None): | ||
| confint = super(DiscreteResults, self).conf_int(alpha=alpha, cols=cols) | ||
| def conf_int(self, alpha=0.05): | ||
| confint = super(DiscreteResults, self).conf_int(alpha=alpha) |
| return cov_params | ||
|
|
||
| def predict(self, params, exog=None, which="mean", linear=None): | ||
| def predict(self, params, exog=None, which="mean"): |
| raise ValueError("endog must be binary, either 0 or 1") | ||
|
|
||
| def predict(self, params, exog=None, which="mean", linear=None, offset=None): | ||
| def predict(self, params, exog=None, which="mean", offset=None): |
| self.df_resid = self.exog.shape[0] - self.df_model - (self.J - 1) | ||
|
|
||
| def predict(self, params, exog=None, which="mean", linear=None): | ||
| def predict(self, params, exog=None, which="mean"): |
| return cov_params | ||
|
|
||
| def predict(self, params, exog=None, which="mean", linear=None): | ||
| def predict(self, params, exog=None, which="mean"): |
5 of 6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
NumPy's guide.
Details
Notes:
needed for doc changes.
then show that it is fixed with the new code.
verify you changes are well formatted by running
flake8is installed. This command is also available on Windowsusing the Windows System for Linux once
flake8is installed in thelocal Linux environment. While passing this test is not required, it is good practice and it help
improve code quality in
statsmodels.