Guest User

Untitled

a guest
Oct 20th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. last_date = df.iloc[1,0]
  2. last_unix = pd.to_datetime('2015-01-31 00:00:00') +pd.Timedelta(13148730)
  3. five_months = 13148730
  4. next_unix = last_unix + five_months
  5.  
  6.  
  7. for i in forecast_set:
  8. next_date = Timestamp('2015-06-30 00:00:00')
  9. next_unix += 13148730
  10. df.loc[next_date] = [np.nan for _ in range(len(df.columns)-1)]+[i]
  11.  
  12. Traceback (most recent call last):
  13.  
  14. File "<ipython-input-23-18adaa6b781f>", line 1, in <module>
  15. runfile('C:/Users/HP/Documents/machine learning.py', wdir='C:/Users/HP/Documents')
  16.  
  17. File "C:UsersHPAnaconda3libsite-packagesspyderlibwidgetsexternalshellsitecustomize.py", line 714, in runfile
  18. execfile(filename, namespace)
  19.  
  20. File "C:UsersHPAnaconda3libsite-packagesspyderlibwidgetsexternalshellsitecustomize.py", line 89, in execfile
  21. exec(compile(f.read(), filename, 'exec'), namespace)
  22.  
  23. File "C:/Users/HP/Documents/machine learning.py", line 74, in <module>
  24. next_unix = last_unix + five_months
  25.  
  26. File "pandastslib.pyx", line 1025, in pandas.tslib._Timestamp.__add__ (pandastslib.c:20118)
  27.  
  28. ValueError: Cannot add integral value to Timestamp without offset.
  29.  
  30. In [20]: pd.to_datetime('2015-01-31 00:00:00') + pd.Timedelta(seconds=13148730)
  31. Out[20]: Timestamp('2015-07-02 04:25:30')
  32.  
  33. In [22]: pd.to_datetime('2015-01-31 00:00:00') + 13148730
  34. ---------------------------------------------------------------------------
  35. ValueError Traceback (most recent call last)
  36. <ipython-input-22-c252fc51ec14> in <module>()
  37. ----> 1 pd.to_datetime('2015-01-31 00:00:00') + 13148730
  38.  
  39. pandastslib.pyx in pandas.tslib._Timestamp.__add__ (pandastslib.c:20225)()
  40.  
  41. ValueError: Cannot add integral value to Timestamp without offset.
Add Comment
Please, Sign In to add comment