Skip to content

Commit

Permalink
CLN: Remove pending deprecations
Browse files Browse the repository at this point in the history
Remove non-tuple indexing
Remove convert_datetime64 flag
Fixed warning test to work with Python 3.7
  • Loading branch information
bashtage committed Aug 2, 2018
1 parent bf34072 commit e44cc1f
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 26 deletions.
18 changes: 9 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ env:
- USENUMPYBASE=false
- MATPLOTLIB=
- DOCBUILD=false
- MKL_NUM_THREADS=1 # Enforce single thread
- NUMEXPR_NUM_THREADS=1
- OMP_NUM_THREADS=1
- OPENBLAS_NUM_THREADS=1
- PYTHONHASHSEED=0 # Ensure tests are correctly gathered by xdist
- OPEN_BLAS=false
- BLAS="mkl blas=*=mkl" # Use Intel MKL by default

matrix:
fast_finish: true
Expand All @@ -29,7 +33,7 @@ matrix:
- python: 2.7
env:
- PYTHON=3.6
- OPEN_BLAS=true
- BLAS="nomkl blas=*=openblas"
- COVERAGE=true
# Python 2.7 + partially updated numpy, mpl; cutting edge scipy, pandas
- python: 2.7
Expand All @@ -52,6 +56,7 @@ matrix:
- PYTHON=2.7
- NUMPY=1.11
- USENUMPYBASE=true
- BLAS= # Do not specify blas in this config due to conflict
- SCIPY=0.18
- PANDAS=0.19
- MATPLOTLIB=1.5
Expand Down Expand Up @@ -90,9 +95,6 @@ before_install:
- chmod +x miniconda.sh
- ./miniconda.sh -b -p /home/travis/miniconda
- export PATH=/home/travis/miniconda/bin:$PATH
- export MKL_NUM_THREADS=1
- export NUMEXPR_NUM_THREADS=1
- export OMP_NUM_THREADS=1
- conda config --set always_yes yes
- conda update --quiet conda
# Fix for headless TravisCI
Expand All @@ -102,18 +104,16 @@ before_install:
- mkdir -p $HOME/.config/matplotlib
- SRCDIR=$PWD
# Build package list to avoid empty package=versions; only needed for versioned packages
- PKGS="python=${PYTHON}"
- PKGS="numpy"; if [ ${NUMPY} ]; then PKGS="${PKGS}=${NUMPY}"; fi
- if [ ${USENUMPYBASE} = true ]; then PKGS="${PKGS} numpy-base=${NUMPY}"; fi
- PKGS="${PKGS} scipy"; if [ ${SCIPY} ]; then PKGS="${PKGS}=${SCIPY}"; fi
- PKGS="${PKGS} patsy"; if [ ${PATSY} ]; then PKGS="${PKGS}=${PATSY}"; fi
- PKGS="${PKGS} pandas"; if [ ${PANDAS} ]; then PKGS="${PKGS}=${PANDAS}"; fi
- PKGS="${PKGS} Cython"; if [ ${CYTHON} ]; then PKGS="${PKGS}=${CYTHON}"; fi
- if [ ${USEMPL} = true ]; then PKGS="${PKGS} matplotlib"; if [ ${MATPLOTLIB} ]; then PKGS="${PKGS}=${MATPLOTLIB}"; fi; fi
- if [ ${OPEN_BLAS} = true ]; then export export BLAS_CONFIG="nomkl blas=*=openblas"; else export BLAS_CONFIG="mkl blas=*=mkl"; fi
- if [ ${COVERAGE} = true ]; then export COVERAGE_OPTS=" --cov-config=.travis_coveragerc --cov=statsmodels "; else export COVERAGE_OPTS=""; fi
- echo conda create --yes --quiet -n statsmodels-test ${PYTHON} ${BLAS_CONFIG} ${PKGS} ${OPTIONAL} pyyaml joblib
- conda create --yes --quiet -n statsmodels-test ${PYTHON} ${BLAS_CONFIG} ${PKGS} ${OPTIONAL} pyyaml joblib
- echo conda create --yes --quiet -n statsmodels-test python=${PYTHON} ${BLAS} ${PKGS} ${OPTIONAL} pyyaml joblib
- conda create --yes --quiet -n statsmodels-test python=${PYTHON} ${BLAS} ${PKGS} ${OPTIONAL} pyyaml joblib
- source activate statsmodels-test
- pip install 'pytest<4' pytest-xdist nose
- if [ ${COVERAGE} = true ]; then pip install codecov coverage coveralls pytest-cov; fi
Expand Down
4 changes: 2 additions & 2 deletions statsmodels/formula/tests/test_formula.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def test_patsy_missing_data():
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
res2 = res.predict(data)
assert_equal(repr(w[-1].message),
"ValueWarning('nan values have been dropped',)")
assert 'ValueWarning' in repr(w[-1].message)
assert 'nan values have been dropped' in repr(w[-1].message)
# Frist record will be dropped in both cases
assert_equal(res.fittedvalues, res2)
4 changes: 2 additions & 2 deletions statsmodels/genmod/cov_struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,8 @@ def initialize(self, model):
# This is used to construct the working correlation
# matrix.
ilabel = np.zeros((ngrp, ngrp), dtype=np.int32)
ilabel[[ix1, ix2]] = ncm + 1
ilabel[[ix2, ix1]] = ncm + 1
ilabel[(ix1, ix2)] = ncm + 1
ilabel[(ix2, ix1)] = ncm + 1
ilabels.append(ilabel)

# This is used to estimate the variance components.
Expand Down
4 changes: 2 additions & 2 deletions statsmodels/imputation/mice.py
Original file line number Diff line number Diff line change
Expand Up @@ -1078,8 +1078,8 @@ def impute_pmm(self, vname):

# Unwind the indices
jj = np.arange(dxi.shape[0])
ix = dxi[[jj, ir]]
iz = ixm[[jj, ix]]
ix = dxi[(jj, ir)]
iz = ixm[(jj, ix)]

imputed_miss = np.array(endog_obs[iz]).squeeze()
self._store_changes(vname, imputed_miss)
Expand Down
2 changes: 1 addition & 1 deletion statsmodels/iolib/summary2.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def as_latex(self):

if self._merge_latex:
# create single tabular object for summary_col
tab = re.sub(to_replace,'\\midrule\n\\midrule\n', tab)
tab = re.sub(to_replace,'\\\midrule\n\\\midrule\n', tab)

out = '\\begin{table}', title, tab, '\\end{table}'
out = '\n'.join(out)
Expand Down
4 changes: 2 additions & 2 deletions statsmodels/iolib/tests/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ def test_regression_with_tuples(self):
df = df.join( i )
endo = df.join( y )
exo = df.join( x )
endo_groups = endo.groupby( ("i",) )
exo_groups = exo.groupby( ("i",) )
endo_groups = endo.groupby("i")
exo_groups = exo.groupby("i")
exo_Df = exo_groups.agg( [np.sum, np.max] )
endo_Df = endo_groups.agg( [np.sum, np.max] )
reg = OLS(exo_Df[[("x", "sum")]],endo_Df).fit()
Expand Down
2 changes: 2 additions & 0 deletions statsmodels/stats/_adnorm.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ def anderson_statistic(x, dist='norm', fit=True, params=(), axis=0):
i = np.arange(1,N+1)
sl1 = [None]*x.ndim
sl1[axis] = slice(None)
sl1 = tuple(sl1)
sl2 = [slice(None)]*x.ndim
sl2[axis] = slice(None,None,-1)
sl2 = tuple(sl2)
S = np.sum((2*i[sl1]-1.0)/N*(np.log(z)+np.log(1-z[sl2])), axis=axis)
A2 = -N-S
return A2
Expand Down
2 changes: 1 addition & 1 deletion statsmodels/tools/eval_measures.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def iqr(x1, x2, axis=0):
idx = np.round((nobs-1) * np.array([0.25, 0.75])).astype(int)
sl = [slice(None)] * xdiff.ndim
sl[axis] = idx
iqr = np.diff(xdiff[sl], axis=axis)
iqr = np.diff(xdiff[tuple(sl)], axis=axis)
iqr = np.squeeze(iqr) # drop reduced dimension
return iqr

Expand Down
2 changes: 1 addition & 1 deletion statsmodels/tsa/statespace/representation.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ def __getitem__(self, key):

# See note on time-varying arrays, below
if matrix.shape[-1] == 1:
return matrix[[slice(None)]*(matrix.ndim-1) + [0]]
return matrix[tuple([slice(None)]*(matrix.ndim-1) + [0])]
else:
return matrix
# Otherwise if we have a tuple, we want a slice of a matrix
Expand Down
2 changes: 1 addition & 1 deletion statsmodels/tsa/tests/test_stattools.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def setup_class(cls):
#cls.acf = np.concatenate(([1.], cls.acf))
cls.qstat = cls.results['Q1']
cls.res1 = acf(cls.x, nlags=40, qstat=True, alpha=.05)
cls.confint_res = cls.results[['acvar_lb','acvar_ub']].as_matrix()
cls.confint_res = cls.results[['acvar_lb','acvar_ub']].values

def test_acf(self):
assert_almost_equal(self.res1[0][1:41], self.acf, DECIMAL_8)
Expand Down
8 changes: 4 additions & 4 deletions statsmodels/tsa/tests/test_tsa_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,25 +478,25 @@ def test_dataframe(self):
assert_frame_equal(expected, appended)

def test_recarray(self):
recarray = pd.DataFrame(self.arr_2d).to_records(index=False, convert_datetime64=False)
recarray = pd.DataFrame(self.arr_2d).to_records(index=False)
appended = tools.add_trend(recarray)
expected = pd.DataFrame(self.arr_2d)
expected['const'] = self.c
expected = expected.to_records(index=False, convert_datetime64=False)
expected = expected.to_records(index=False)
assert_equal(expected, appended)

prepended = tools.add_trend(recarray, prepend=True)
expected = pd.DataFrame(self.arr_2d)
expected.insert(0, 'const', self.c)
expected = expected.to_records(index=False, convert_datetime64=False)
expected = expected.to_records(index=False)
assert_equal(expected, prepended)

appended = tools.add_trend(recarray, trend='ctt')
expected = pd.DataFrame(self.arr_2d)
expected['const'] = self.c
expected['trend'] = self.t
expected['trend_squared'] = self.t ** 2
expected = expected.to_records(index=False, convert_datetime64=False)
expected = expected.to_records(index=False)
assert_equal(expected, appended)

def test_duplicate_const(self):
Expand Down
2 changes: 1 addition & 1 deletion statsmodels/tsa/tsatools.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def safe_is_const(s):
x = np.column_stack(x[::order])

if is_recarray:
x = x.to_records(index=False, convert_datetime64=False)
x = x.to_records(index=False)
new_descr = x.dtype.descr
extra_col = len(new_descr) - len(descr)
if prepend:
Expand Down

0 comments on commit e44cc1f

Please sign in to comment.