Skip to content

MAINT: Avoid/Fix FutureWarnings - #5204

Merged
bashtage merged 1 commit into
statsmodels:masterfrom
jbrockmendel:manywarns5
May 2, 2019
Merged

bashtage merged 1 commit into
statsmodels:masterfrom
jbrockmendel:manywarns5

Conversation

@jbrockmendel

Copy link
Copy Markdown
Contributor

Broken off from #5132.

The part remaining over there is internal use of apparently-deprecated statsmodels API. First pass at updating that usage broke a bunch of tests. This part should be pretty easy.

@coveralls

coveralls commented Sep 14, 2018 •

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.008%) to 84.475% when pulling 1018dfc on jbrockmendel:manywarns5 into a9c465b on statsmodels:master.

@jbrockmendel

Copy link
Copy Markdown
Contributor Author

@josef-pkt defacto green

@jbrockmendel

Copy link
Copy Markdown
Contributor Author

@josef-pkt green, fixes/avoids FutureWarnings


The parameter estimates solves the moment equation:

.. math:: (X' \\Sigma X + \\lambda R' \\sigma^2 \\Simga_p^{-1} R) b = X' \\Sigma y + \\lambda R' \\Simga_p^{-1} q

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.

this is already properly escaped

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 thought adding the “r” to the docstring means you only use one backslash. Am I confusing this with something else?

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.

r means no escaping, without r backslash needs escaping ->\.

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.

I would use r and one \ since the docstring is mixed (some \ some \).

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.

@bashtage I thought that’s what I did here. Did I miss something?

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.

You are right, The docstring was mixed so you could have added r and moved to single escapes or left the r off and moved everything to double escape. I was mostly addressing @josef-pkt point about the escaping being correct which was right for that line but wrong for the docstring overall.

Comment thread statsmodels/base/data.py
@classmethod
def _drop_nans_2d(cls, x, nan_mask):
if hasattr(x, 'ix'):
if isinstance(x, (Series, DataFrame)):

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.

maybe hasattr(x 'loc') to maintain the ducktyping
I don't know whether it matters here or not

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.

8 lines up this was changed last week, was missed here. It should definitely be consistent.

These are very specifically the two classes we want to catch.

@jbrockmendel

Copy link
Copy Markdown
Contributor Author

@josef-pkt might be helpful to get this through before conflicts with 5220 arise

@jbrockmendel

Copy link
Copy Markdown
Contributor Author

@josef-pkt sounds like we have consensus here

@jbrockmendel

Copy link
Copy Markdown
Contributor Author

@josef-pkt any other requested changes?

@jbrockmendel

Copy link
Copy Markdown
Contributor Author

@josef-pkt can we get this in and clear some of the warnings out of the test logs?

@jbrockmendel

Copy link
Copy Markdown
Contributor Author

@josef-pkt there was briefly an interest in fixing these runtime warnings... lets finish the job

@josef-pkt

Copy link
Copy Markdown
Member

including local cleanups does not mean pep-8ing the entire module.
e.g. 1 relevant line out or 11 or 2 lines out of 14

I think the data.design_info.builder changes could be merged.
The rest might have overlap with other PRs or is pep-8 mixed in with refactoring REF/MAINT.

@bashtage

bashtage commented May 1, 2019

Copy link
Copy Markdown
Member

Needs rebase.

@bashtage bashtage self-assigned this May 1, 2019
@codecov

codecov Bot commented May 1, 2019

Copy link
Copy Markdown

Codecov Report

Merging #5204 into master will decrease coverage by 0.51%.
The diff coverage is 81.25%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5204      +/-   ##
==========================================
- Coverage   81.98%   81.46%   -0.52%     
==========================================
  Files         588      569      -19     
  Lines       93110    89718    -3392     
  Branches    10320    10043     -277     
==========================================
- Hits        76332    73093    -3239     
+ Misses      14406    14341      -65     
+ Partials     2372     2284      -88
Impacted Files Coverage Δ
statsmodels/sandbox/nonparametric/kernel_extras.py 31.17% <ø> (ø) ⬆️
statsmodels/regression/_prediction.py 80.51% <0%> (ø) ⬆️
statsmodels/genmod/_prediction.py 79.81% <0%> (ø) ⬆️
statsmodels/sandbox/regression/penalized.py 69.79% <100%> (ø) ⬆️
...ar/tests/JMulTi_results/parse_jmulti_var_output.py 91.21% <100%> (ø) ⬆️
statsmodels/sandbox/predict_functional.py 77.63% <50%> (ø) ⬆️
statsmodels/base/data.py 90.44% <66.66%> (ø) ⬆️
statsmodels/tsa/kalmanf/kalmanfilter.py 36.08% <0%> (-53.01%) ⬇️
statsmodels/sandbox/utils_old.py 41.66% <0%> (-27.3%) ⬇️
statsmodels/graphics/tests/test_correlation.py 90.47% <0%> (-9.53%) ⬇️
... and 212 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 a9c465b...1018dfc. Read the comment docs.

1 similar comment
@codecov

codecov Bot commented May 1, 2019

Copy link
Copy Markdown

Codecov Report

Merging #5204 into master will decrease coverage by 0.51%.
The diff coverage is 81.25%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5204      +/-   ##
==========================================
- Coverage   81.98%   81.46%   -0.52%     
==========================================
  Files         588      569      -19     
  Lines       93110    89718    -3392     
  Branches    10320    10043     -277     
==========================================
- Hits        76332    73093    -3239     
+ Misses      14406    14341      -65     
+ Partials     2372     2284      -88
Impacted Files Coverage Δ
statsmodels/sandbox/nonparametric/kernel_extras.py 31.17% <ø> (ø) ⬆️
statsmodels/regression/_prediction.py 80.51% <0%> (ø) ⬆️
statsmodels/genmod/_prediction.py 79.81% <0%> (ø) ⬆️
statsmodels/sandbox/regression/penalized.py 69.79% <100%> (ø) ⬆️
...ar/tests/JMulTi_results/parse_jmulti_var_output.py 91.21% <100%> (ø) ⬆️
statsmodels/sandbox/predict_functional.py 77.63% <50%> (ø) ⬆️
statsmodels/base/data.py 90.44% <66.66%> (ø) ⬆️
statsmodels/tsa/kalmanf/kalmanfilter.py 36.08% <0%> (-53.01%) ⬇️
statsmodels/sandbox/utils_old.py 41.66% <0%> (-27.3%) ⬇️
statsmodels/graphics/tests/test_correlation.py 90.47% <0%> (-9.53%) ⬇️
... and 212 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 a9c465b...1018dfc. Read the comment docs.

@jbrockmendel

Copy link
Copy Markdown
Contributor Author

Rebased, looks like all that is left is the wrapping of one 81-character line.

@bashtage
bashtage merged commit b534f91 into statsmodels:master May 2, 2019
@jbrockmendel
jbrockmendel deleted the manywarns5 branch May 2, 2019 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants