title: Expand time series data in pandas dataframe
body: <p>I am attempting to interpolate between time points for all data in a pandas dataframe. My current data is in time increments of 0.04 seconds. I want it to be in increments of 0.01 seconds to match another data set. I realize I can use the DataFrame.interpolate() function to do this. However, I am stuck on how to insert 3 rows of NaN in-between every row of my dataframe in an efficient manner.</p>
  <pre><code>import pandas as pd
  import numpy as np
  
  df = pd.DataFrame(data={&quot;Time&quot;: [0.0, 0.04, 0.08, 0.12], 
                          &quot;Pulse&quot;: [76, 74, 77, 80],
                          &quot;O2&quot;:[99, 100, 99, 98]})
  df_ins = pd.DataFrame(data={&quot;Time&quot;: [np.nan, np.nan, np.nan], 
                              &quot;Pulse&quot;: [np.nan, np.nan, np.nan],
                              &quot;O2&quot;:[np.nan, np.nan, np.nan]})
  </code></pre>
  <p>I want df to transform from this:</p>
  <pre><code>    Time    Pulse   O2
  0   0.00    76      99
  1   0.04    74      100
  2   0.08    77      99
  3   0.12    80      98
  </code></pre>
  <p>To something like this:</p>
  <pre><code>    Time    Pulse   O2
  0   0.00    76      99
  1   NaN     NaN     NaN
  2   NaN     NaN     NaN
  3   NaN     NaN     NaN
  4   0.04    74      100
  5   NaN     NaN     NaN
  6   NaN     NaN     NaN
  7   NaN     NaN     NaN
  8   0.08    77      99
  9   NaN     NaN     NaN
  10  NaN     NaN     NaN
  11  NaN     NaN     NaN
  12  0.12    80      98
  </code></pre>
  <p>Which I can then call on</p>
  <pre><code>df = df.interpolate()
  </code></pre>
  <p>Which would yield something like this (I'm making up the numbers here):</p>
  <pre><code>    Time    Pulse   O2
  0   0.00    76      99
  1   0.01    76      99
  2   0.02    75      99
  3   0.03    74      100
  4   0.04    74      100
  5   0.05    75      100
  6   0.06    76      99
  7   0.07    77      99
  8   0.08    77      99
  9   0.09    77      99
  10  0.10    78      98
  11  0.11    79      98
  12  0.12    80      98
  </code></pre>
  <p>I attempted to use an iterrows technique by inserting the df_ins frame after every row. But my index was thrown off during the iteration. I also tried slicing df and concatenating the df slices and df_ins, but once again the indexes were thrown off by the loop.</p>
  <p>Does anyone have any recommendations on how to do this efficiently?</p>