How do i work out this date time issue in python
<p>I am new to Python and machine learning and i am trying to work out how to fix this issue with date time. next_unix is 13148730, because that is how many seconds are in five months, which is the time in between my dates. I have searched and i can't seem to find anything that works.</p>

<pre><code>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]
</code></pre>

<p>Error:
  Traceback (most recent call last):</p>

<p>File "", line 1, in 
    runfile('C:/Users/HP/Documents/machine learning.py', wdir='C:/Users/HP/Documents')</p>

<p>File "C:\Users\HP\Anaconda3\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 714, in runfile
    execfile(filename, namespace)</p>

<p>File "C:\Users\HP\Anaconda3\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 89, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)</p>

<p>File "C:/Users/HP/Documents/machine learning.py", line 74, in 
    next_unix = last_unix + five_months</p>

<p>File "pandas\tslib.pyx", line 1025, in pandas.tslib._Timestamp.<strong>add</strong> (pandas\tslib.c:20118)</p>

<p>ValueError: Cannot add integral value to Timestamp without offset.</p>

<p>you can use <a href="http://pandas.pydata.org/pandas-docs/stable/timedeltas.html" rel="nofollow">pd.Timedelta()</a> method:</p>

<pre><code>In [20]: pd.to_datetime('2015-01-31 00:00:00') + pd.Timedelta(seconds=13148730)
Out[20]: Timestamp('2015-07-02 04:25:30')
</code></pre>

<p>if we try to add number of seconds to Pandas DateTime:</p>

<pre><code>In [22]: pd.to_datetime('2015-01-31 00:00:00') + 13148730
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
&lt;ipython-input-22-c252fc51ec14&gt; in &lt;module&gt;()
----&gt; 1 pd.to_datetime('2015-01-31 00:00:00') + 13148730

pandas\tslib.pyx in pandas.tslib._Timestamp.__add__ (pandas\tslib.c:20225)()

ValueError: Cannot add integral value to Timestamp without offset.
</code></pre>

python pandas