Python pandas interpolating series
<p>I have data in a csv file which appears as:</p>

<pre><code>  DateTime       Temp
10/1/2016 0:00  20.35491156
10/1/2016 1:00  19.75320845
10/1/2016 4:00  17.62411292
10/1/2016 5:00  18.30190001
10/1/2016 6:00  19.37101638
</code></pre>

<p>I am reading this file from csv file as:</p>

<pre><code>import numpy as np
import pandas as pd
d2 = pd.Series.from_csv(r'C:\PowerCurve.csv')
d3 = d2.interpolate(method='time')
</code></pre>

<p>My goal is to fill the missing hours 2 and 3 with interpolation based on nearby values. i.e. every time there is are missing data it should do the interpolation.</p>

<p>However, d3 doesn't show any interpolation.</p>

<p>Edit:
Based on suggestions below my Python 2.7 still errors out. I am trying the following:</p>

<pre><code>import pandas as pd
d2 = pd.Series.from_csv(r'C:\PowerCurve.csv')
d2.set_index('DateTime').resample('H').interpolate()
</code></pre>

<p>Error is:</p>

<pre><code>File "C:\Python27\lib\site-packages\pandas\core\generic.py", line 2672, in __getattr__
    return object.__getattribute__(self, name)
AttributeError: 'Series' object has no attribute 'set_index'
</code></pre>

<p>use the <code>interpolate</code> method after <code>resample</code> on an hourly basis.</p>

<pre><code>d2.set_index('DateTime').resample('H').interpolate()
</code></pre>

<p>If <code>d2</code> is a series then we don't need the set_index</p>

<pre><code>d2.resample('H').interpolate()
</code></pre>

<p><a href="http://i.stack.imgur.com/cMbuU.png" rel="nofollow"><img src="http://i.stack.imgur.com/cMbuU.png" alt="enter image description here"></a></p>

python pandas interpolation