how to insert new row in pandas data frame at desired index
<p>I have a data frame which has missing dates </p>

<pre><code>print data 

Date  Longitude  Latitude  Elevation  Max Temperature  \
4/11/1979  83.75  24.197701       238     44.769           20.007   
4/12/1979  83.75  24.197701       238     41.967           18.027   
4/13/1979  83.75  24.197701       238     43.053           20.549    
4/15/1979  83.75  24.197701       238     40.826           20.189
</code></pre>

<p>How do I insert <code>4/14/1979</code> at the <code>4th</code> row</p>

<p>print data </p>

<pre><code>Date  Longitude  Latitude  Elevation  Max Temperature  \
4/11/1979  83.75  24.197701       238     44.769           20.007   
4/12/1979  83.75  24.197701       238     41.967           18.027   
4/13/1979  83.75  24.197701       238     43.053           20.549
4/14/1979  0.0    0.0             0       0.0              0.0
4/15/1979  83.75  24.197701       238     40.826           20.189
</code></pre>

<p>First convert column <code>Date</code> <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.to_datetime.html" rel="nofollow"><code>to_datetime</code></a>, then <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.set_index.html" rel="nofollow"><code>set_index</code></a> for resampling.</p>

<p>You can use <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.resample.html" rel="nofollow"><code>resample</code></a> by <code>D</code> (<code>days</code>) and then need fill <code>NaN</code> to <code>0</code>, one posible solution is <a href="http://stackoverflow.com/q/39452095/2901002"><code>replace({np.nan:0})</code></a>:</p>

<pre><code>df['Date'] = pd.to_datetime(df.Date)
df.set_index('Date', inplace=True)

df = df.resample('D').replace({np.nan:0}).reset_index()
print (df)
        Date  Longitude   Latitude  Elevation     Max  Temperature
0 1979-04-11      83.75  24.197701      238.0  44.769       20.007
1 1979-04-12      83.75  24.197701      238.0  41.967       18.027
2 1979-04-13      83.75  24.197701      238.0  43.053       20.549
3 1979-04-14       0.00   0.000000        0.0   0.000        0.000
4 1979-04-15      83.75  24.197701      238.0  40.826       20.189
</code></pre>

python pandas dataframe resampling