Skip to content

Commit 59b0c1c

Browse files
committed
MAINT: Remove problematic array structures
1 parent 15a4620 commit 59b0c1c

File tree

6 files changed

+16
-10
lines changed

6 files changed

+16
-10
lines changed

setup.cfg

+1-1
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/distributions/copula/archimedean.py

+3-3
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

+3-2
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

+5-3
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

+1
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)

statsmodels/sandbox/distributions/tests/test_transf.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def setup_class(cls):
101101

102102
def test_equivalent(self):
103103
xx, ppfq = self.xx, self.ppfq
104-
for d1,d2 in self.dist_equivalents:
104+
for j,(d1,d2) in enumerate(self.dist_equivalents):
105105
## print d1.name
106106
assert_almost_equal(d1.cdf(xx), d2.cdf(xx), err_msg='cdf'+d1.name)
107107
assert_almost_equal(d1.pdf(xx), d2.pdf(xx),
@@ -122,6 +122,8 @@ def test_equivalent(self):
122122
d2mom = d2.dist.moment(3, *d2.args)
123123
else:
124124
d2mom = d2.moment(3)
125+
if j==3:
126+
print("now")
125127
assert_almost_equal(d1.moment(3), d2mom,
126128
DECIMAL,
127129
err_msg='moment '+d1.name+d2.name)

0 commit comments

Comments
 (0)