Skip to content

BUG: TSA _get_predict_start, _get_predict_end do not accept datetime objects #2780

Closed

Description

@ChadFulton

The tsa helper functions for predict do not allow passing a datetime type, even though they allow passing a string which gets converted to a datetime type.

Activity

  1. josef-pkt commented on Jan 19, 2016

    @josef-pkt
    Member

    see also #1857

    I thought there is a specific issue still open, but don't find it.
    I added the ability to use some pandas date or time representation in there, but didn't know how many different versions there are to specify a datetime.

  2. Acertainuser commented on Jan 26, 2016

    @Acertainuser

    I also encounter the same problem trying to forecast timesries with AR, ARMA, ARIMA and passing a datetime index for start and end.
    The problem here is that I can pass a pandas timeseries index for the start but not the end. The Function:

    start = self._get_predict_start(start, dynamic) # line 192 of ar_model
    

    correctly inferes the right integer index to the starting point BUT the function

    end, out_of_sample = self._get_predict_end(end)  # line 193 of ar_model
    

    has no functionality to do the same for the end. In function

    _validate(start, k_ar, dates, method) # line 31 ar_model
    

    here a check is performed to also accept datetime

    from datetime import datetime
    if isinstance(start, (string_types, datetime)):
        start_date = start
        start = _index_date(start, dates)
    

    This is not done at

    _get_predict_end(self, end) # line 135 of tsa_model
    

    here only the instances string and int are approved.

    A fix for the module to accept datetimes for start and end, even for out of sample would greatly improve the usefullness and useability of the model for timeseries forecasting in combiniation with pandas.

  3. ChadFulton commented on Oct 8, 2017

    @ChadFulton
    MemberAuthor

    This was fixed by the larger date refactoring.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions