Skip to content

Commit 993af1f

Browse files
authored
Merge pull request statsmodels#8826 from bashtage/pre-deprecations
MAINT/DOC: Fix more deprecations and restore doc build
2 parents f745e5b + a653598 commit 993af1f

File tree

11 files changed

+30
-12
lines changed

11 files changed

+30
-12
lines changed

docs/source/contingency_tables.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ contingency table cell counts:
5050
import statsmodels.api as sm
5151
5252
df = sm.datasets.get_rdataset("Arthritis", "vcd").data
53+
df.fillna({"Improved":"None"}, inplace=True)
5354
5455
tab = pd.crosstab(df['Treatment'], df['Improved'])
5556
tab = tab.loc[:, ["None", "Some", "Marked"]]

docs/source/plots/stl_plot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import numpy as np
12
import matplotlib.pyplot as plt
23
from pandas.plotting import register_matplotlib_converters
34

@@ -8,6 +9,6 @@
89
data = co2.load().data
910
data = data.resample('M').mean().ffill()
1011

11-
res = STL(data).fit()
12+
res = STL(np.squeeze(data)).fit()
1213
res.plot()
1314
plt.show()

docs/source/treatment.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11

22
.. module:: statsmodels.treatment
3-
.. currentmodule:: statsmodels.treatment
43
:synopsis: Treatment Effect
54

5+
.. currentmodule:: statsmodels.treatment
6+
7+
68

79
.. _othermod:
810

requirements-doc.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Requirements for doc build, in addition to requirements.txt
22
sphinx>=5,<6
3+
# Avoid warnings which break Sphinx by pinning pandas
4+
pandas>=2.0,<2.1
35
sphinx-material
46
jupyter
57
notebook
@@ -14,3 +16,4 @@ theano-pymc; os_name != "nt"
1416
pymc3; os_name != "nt"
1517
arviz; os_name != "nt"
1618
jinja2==3.0.3
19+

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ filterwarnings =
7777
error:The probit link alias is deprecated:FutureWarning:
7878
error:Parsing dates in:UserWarning
7979
error:A value is trying to be set on a copy::
80-
error:Conversion of an array with ndim:DeprecationWarning:statsmodels
80+
error:Conversion of an array with ndim:DeprecationWarning:
8181
markers =
8282
example: mark a test that runs example code
8383
matplotlib: mark a test that requires matplotlib

statsmodels/datasets/danish_data/data.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ def load():
6060

6161
def _get_data():
6262
data = du.load_csv(__file__, "data.csv")
63+
for i, val in enumerate(data.period):
64+
parts = val.split("Q")
65+
month = (int(parts[1]) - 1) * 3 + 1
66+
67+
data.loc[data.index[i], "period"] = f"{parts[0]}-{month:02d}-01"
6368
data["period"] = pd.to_datetime(data.period)
6469
return data.set_index("period").astype(float)
6570

statsmodels/distributions/copula/archimedean.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ def _debye(alpha):
2121
EPSILON = np.finfo(np.float64).eps * 100
2222

2323
def integrand(t):
24-
return t / (np.exp(t) - 1)
25-
26-
debye_value = integrate.quad(integrand, EPSILON, alpha)[0] / alpha
24+
return np.squeeze(t / (np.exp(t) - 1))
25+
_alpha = np.squeeze(alpha)
26+
debye_value = integrate.quad(integrand, EPSILON, _alpha)[0] / _alpha
2727
return debye_value
2828

2929

statsmodels/emplike/originregress.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ def conf_int_el(self, param_num, upper_bound=None,
250250
f = lambda b0: self.el_test(np.array([b0]), param_num,
251251
method=method,
252252
stochastic_exog=stochastic_exog)[0] - r0
253-
lowerl = optimize.brentq(f, lower_bound, self.params[param_num])
254-
upperl = optimize.brentq(f, self.params[param_num], upper_bound)
253+
_param = np.squeeze(self.params[param_num])
254+
lowerl = optimize.brentq(f, np.squeeze(lower_bound), _param)
255+
upperl = optimize.brentq(f, _param, np.squeeze(upper_bound))
255256
return (lowerl, upperl)

statsmodels/genmod/families/tests/test_family.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,10 @@ def test_tweedie_loglike_obs(power):
100100
scale = 2.9
101101

102102
def pdf(y):
103-
return np.exp(tweedie.loglike_obs(
104-
endog=y, mu=mu, scale=scale
105-
))
103+
return np.squeeze(
104+
np.exp(
105+
tweedie.loglike_obs(endog=y, mu=mu, scale=scale)
106+
)
107+
)
106108

107109
assert_allclose(pdf(0) + integrate.quad(pdf, 0, 1e2)[0], 1, atol=1e-4)

statsmodels/sandbox/distributions/extras.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,7 @@ def _sf(self, x, *args, **kwargs):
817817
return 1.0 - self._cdf(x, *args, **kwargs)
818818

819819
def _munp(self, n, *args, **kwargs):
820+
args = [np.squeeze(arg) for arg in args]
820821
out = np.squeeze(self._mom0_sc(n, *args))
821822
if np.isscalar(out):
822823
return float(out)

0 commit comments

Comments
 (0)