Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- last_date = df.iloc[1,0]
- last_unix = pd.to_datetime('2015-01-31 00:00:00') +pd.Timedelta(13148730)
- five_months = 13148730
- next_unix = last_unix + five_months
- for i in forecast_set:
- next_date = Timestamp('2015-06-30 00:00:00')
- next_unix += 13148730
- df.loc[next_date] = [np.nan for _ in range(len(df.columns)-1)]+[i]
- Traceback (most recent call last):
- File "<ipython-input-23-18adaa6b781f>", line 1, in <module>
- runfile('C:/Users/HP/Documents/machine learning.py', wdir='C:/Users/HP/Documents')
- File "C:UsersHPAnaconda3libsite-packagesspyderlibwidgetsexternalshellsitecustomize.py", line 714, in runfile
- execfile(filename, namespace)
- File "C:UsersHPAnaconda3libsite-packagesspyderlibwidgetsexternalshellsitecustomize.py", line 89, in execfile
- exec(compile(f.read(), filename, 'exec'), namespace)
- File "C:/Users/HP/Documents/machine learning.py", line 74, in <module>
- next_unix = last_unix + five_months
- File "pandastslib.pyx", line 1025, in pandas.tslib._Timestamp.__add__ (pandastslib.c:20118)
- ValueError: Cannot add integral value to Timestamp without offset.
- In [20]: pd.to_datetime('2015-01-31 00:00:00') + pd.Timedelta(seconds=13148730)
- Out[20]: Timestamp('2015-07-02 04:25:30')
- In [22]: pd.to_datetime('2015-01-31 00:00:00') + 13148730
- ---------------------------------------------------------------------------
- ValueError Traceback (most recent call last)
- <ipython-input-22-c252fc51ec14> in <module>()
- ----> 1 pd.to_datetime('2015-01-31 00:00:00') + 13148730
- pandastslib.pyx in pandas.tslib._Timestamp.__add__ (pandastslib.c:20225)()
- ValueError: Cannot add integral value to Timestamp without offset.
Add Comment
Please, Sign In to add comment