Skip to content

[MAINT] update compat to remove unusable shims e.g. py26 - #5000

Merged
josef-pkt merged 11 commits into
statsmodels:masterfrom
jbrockmendel:npcompat
Aug 27, 2018
Merged

josef-pkt merged 11 commits into
statsmodels:masterfrom
jbrockmendel:npcompat

Conversation

@jbrockmendel

Copy link
Copy Markdown
Contributor

After this, compat.scipy.NumpyVersion is never used, may be removable in a follow-up.

@josef-pkt josef-pkt added this to the 0.10 milestone Aug 24, 2018
@josef-pkt

Copy link
Copy Markdown
Member

LGTM

@bashtage

Copy link
Copy Markdown
Member

A couple more that I think are not relevant any more:

@pytest.mark.skipif(NP16, reason='numpy<1.7')

RangeIndex is in Pandas 0.18+

@jbrockmendel

Copy link
Copy Markdown
Contributor Author

A couple more that I think are not relevant any more:

Thanks, will update.

@jbrockmendel

Copy link
Copy Markdown
Contributor Author

Should we get rid of NumpyVersion while we’re at it?

@bashtage

Copy link
Copy Markdown
Member

Should we get rid of NumpyVersion while we’re at it?

If it is completely unused then let it go.

@jbrockmendel

Copy link
Copy Markdown
Contributor Author

If it is completely unused then let it go.

I very much agree, but in the past @josef-pkt has insisted on keeping code that is not used internally on the theory that it might be used externally. Waiting for the go-ahead on this one.

@jbrockmendel

Copy link
Copy Markdown
Contributor Author

Turns out we can get NumpyVersion from numpy.lib since 1.9.0. Also some of the pandas shims are no longer needed. Updated.


import numpy as np
import pandas
from pandas import RangeIndex, Float64Index # noqa:F401

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, anything that not needed from compat should be directly imported from the package that provides it.

from pandas import RangeIndex
except ImportError:
RangeIndex = tuple()
def sort_values(df, *args, **kwargs):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here -- we shouldn't be calling compat.sort_values (df) but df.sort_values()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, prefer to do this in a subsequent pass as the diff would touch a bunch of other files.

@josef-pkt

Copy link
Copy Markdown
Member

has insisted on keeping code that is not used internally on the theory that it might be used externally.

That refers to different type of code, i.e. you wanted delete functions that are only user facing and we don't use them internally.
I don't have an opinion about NumpyVersion because I haven't looked at it in a long time. Using NumpyVersion was the old standard way for numpy, scipy, ... version check, and was guaranteed to work. (i.e. when a numpy release didn't satisfy it then there was an outcry and it was immediately changed back.)
If we don't need it anymore, then I won't miss it either.

@codecov-io

Copy link
Copy Markdown

Codecov Report

Merging #5000 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5000      +/-   ##
==========================================
+ Coverage   81.42%   81.43%   +<.01%     
==========================================
  Files         582      582              
  Lines       90124    90076      -48     
  Branches    10096    10088       -8     
==========================================
- Hits        73384    73352      -32     
+ Misses      14435    14422      -13     
+ Partials     2305     2302       -3
Impacted Files Coverage Δ
statsmodels/tsa/tests/test_arima_process.py 100% <ø> (ø) ⬆️
statsmodels/base/tests/test_generic_methods.py 96.42% <ø> (-0.01%) ⬇️
...odels/sandbox/regression/tests/test_gmm_poisson.py 95.16% <ø> (-0.03%) ⬇️
statsmodels/discrete/tests/test_discrete.py 98.97% <ø> (+0.56%) ⬆️
statsmodels/base/optimizer.py 80.9% <ø> (+1.08%) ⬆️
statsmodels/base/tests/test_optimize.py 100% <ø> (+5.71%) ⬆️
statsmodels/stats/_knockoff.py 66.66% <100%> (-0.31%) ⬇️
statsmodels/tsa/tests/test_tsa_indexes.py 95.66% <100%> (+0.96%) ⬆️
statsmodels/stats/tests/test_diagnostic.py 92.03% <100%> (+0.19%) ⬆️
statsmodels/tsa/statespace/tests/test_kalman.py 95.39% <100%> (+1.82%) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d7e5183...9400995. Read the comment docs.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.006%) to 83.961% when pulling 9400995 on jbrockmendel:npcompat into d7e5183 on statsmodels:master.

@jbrockmendel

Copy link
Copy Markdown
Contributor Author

@josef-pkt good to go

@josef-pkt
josef-pkt merged commit 4468d3c into statsmodels:master Aug 27, 2018
@josef-pkt

Copy link
Copy Markdown
Member

@jbrockmendel @bashtage Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants