I am trying to generate one hour one hour time interval to predict next value according to my data set imported from csv file. Here according to the time it will give outputs include in x column. This output is actual value and I want to predict next value at 12.40 p.m (time) according to the past actual values and the time. For that I need to write an array for one hour to one hour continuously to predict the value with next time . I don't know how to proceed the time array after converting it.

subset of actual dataset;

enter image description here

Can you give me any suggestion to me solve this code?

My code is,

data = pd.read_csv('data4.csv')
data['Time'] = (pd.DatatimeIndex(data['Time']).astype(np.int64)//10**9)%86400
  • 2
    $\begingroup$ It may help stackoverflow.com/questions/39298054/… $\endgroup$ Commented Sep 21, 2018 at 9:54
  • $\begingroup$ I tried this method but I can't predict the value for next time. Because this will continue to next day next to next day and etc. Then here I can't write the end time. Then what should I have to write for time ? @bakka $\endgroup$
    – awa
    Commented Sep 21, 2018 at 9:59
  • 1
    $\begingroup$ I think generating time interval and predicting the value is two different thing, isn't? Now you want to generate time interval. Then you can modify a bit from the answer in above link. e.g dts = [dt.strftime('%H:%M') for dt in datetime_range(datetime(2018, 1, 1, 12, 40), datetime(2018, 1, 1, 23,40), timedelta(minutes=60))] $\endgroup$ Commented Sep 21, 2018 at 10:09
  • $\begingroup$ Yes that two are different. So here you put datetime_range but if I want to put this datetime_range auto for next day , then how to code it ? @bakka $\endgroup$
    – awa
    Commented Sep 21, 2018 at 10:18
  • 2
    $\begingroup$ Just change the range. If you want generate time from 21-09-2018 12:40 until 25-09-2018 23:40, then datetime_range(datetime(2018, 9, 21 , 12, 40), datetime(2018, 9, 25, 23,41), timedelta(minutes=60)) $\endgroup$ Commented Sep 21, 2018 at 10:35


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.