Skip to content

BUG/TST: TSA models: _get_index_label_loc failed when using row labels. - #5250

Merged
ChadFulton merged 3 commits into
statsmodels:masterfrom
ChadFulton:tsa-dates-fix
Sep 25, 2018
Merged

ChadFulton merged 3 commits into
statsmodels:masterfrom
ChadFulton:tsa-dates-fix

Conversation

@ChadFulton

Copy link
Copy Markdown
Member

The bug causes problems with predict. For example:

import numpy as np
import pandas as pd
import statsmodels.api as sm

endog = pd.Series([1, 2, 3, 4], index=['a', 'b', 'c', 'd'])
mod = sm.tsa.SARIMAX(endog)
res = mod.filter([0., 1])
res.predict(end='c')

would yield a:

KeyError: 'The `end` argument could not be matched to a
           location related to the index of the data.'

@coveralls

coveralls commented Sep 23, 2018 •

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.02%) to 84.218% when pulling 93b0b2a on ChadFulton:tsa-dates-fix into 2f831ad on statsmodels:master.

# pandas.Index.get_loc as of 0.23.4)
else:
loc = loc[0]
if not isinstance(loc, numbers.Integral):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Will this get e.g. np.int64(2)? (And is that a relevant case?)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It will get it, and it is a relevant case!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good. Here's a corner case that surprised me:

t = np.timedelta64(3, 'ns')
isinstance(t, numbers.Integral)
True

Not really worth worrying about here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

:( that makes me sad. Maybe there's a good reason for that.

@codecov

codecov Bot commented Sep 23, 2018 •

Copy link
Copy Markdown

Codecov Report

Merging #5250 into master will decrease coverage by 0.03%.
The diff coverage is 89.83%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5250      +/-   ##
==========================================
- Coverage    81.7%   81.66%   -0.04%     
==========================================
  Files         569      569              
  Lines       89628    89678      +50     
  Branches    10025    10029       +4     
==========================================
+ Hits        73227    73239      +12     
- Misses      14130    14161      +31     
- Partials     2271     2278       +7
Impacted Files Coverage Δ
statsmodels/tsa/base/tests/test_tsa_indexes.py 96.25% <100%> (+0.39%) ⬆️
statsmodels/tsa/base/tsa_model.py 87.03% <33.33%> (-4.79%) ⬇️
statsmodels/iolib/openfile.py 66.66% <0%> (-9.1%) ⬇️
statsmodels/datasets/utils.py 80.24% <0%> (-3.09%) ⬇️
statsmodels/tsa/tsatools.py 87.3% <0%> (-2.48%) ⬇️
statsmodels/iolib/tests/test_foreign.py 96.85% <0%> (-1.58%) ⬇️
statsmodels/iolib/foreign.py 71.23% <0%> (-1.39%) ⬇️
statsmodels/discrete/tests/test_discrete.py 98.96% <0%> (-0.3%) ⬇️
statsmodels/tsa/statespace/mlemodel.py 85.73% <0%> (-0.24%) ⬇️
... and 9 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 2f831ad...93b0b2a. Read the comment docs.

@ChadFulton

Copy link
Copy Markdown
Member Author

Green, will merge tomorrow unless there are concerns.

@ChadFulton
ChadFulton merged commit 8515b22 into statsmodels:master Sep 25, 2018
@ChadFulton
ChadFulton deleted the tsa-dates-fix branch September 25, 2018 00:00
@josef-pkt josef-pkt added this to the 0.10 milestone Dec 5, 2018
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.

4 participants