title: Measuring the duration of NaN gaps in columns of Pandas Series
body: <p>I have a pandas DataFrame with an irregular sampling pattern that has gaps in each column. To provide a concrete example:</p>
  
  <pre><code>tndx = pd.DatetimeIndex(['2019-01-04 00:00','2019-01-04 03:00',
                           '2019-01-04 10:17','2019-01-04 19:00',
                           '2019-01-05 09:00','2019-01-06 10:00',
                           '2019-01-07 16:00','2019-01-09 14:50'])
  
  data = {"op":['a','a','b','b','b',np.nan,np.nan,np.nan], 
          "setting":[1.,2.,1.,np.nan,np.nan,2.,1.,np.nan]}
  df = pd.DataFrame(data=data,index = tndx)
  
  
                        op  setting 
  2019-01-04 00:00:00    a      1.0 
  2019-01-04 03:00:00    a      2.0 
  2019-01-04 10:17:00    b      1.0
  2019-01-04 19:00:00    b      NaN 
  2019-01-05 09:00:00    b      NaN
  2019-01-06 10:00:00  NaN      2.0 
  2019-01-07 16:00:00  NaN      1.0
  2019-01-09 14:50:00  NaN      NaN
  </code></pre>
  
  <p>I would like to create a DataFrame of the same dimensions with each entry representing the duration of the current NaN/non-NaN state.  So that output using minutes would be:</p>
  
  <pre><code>                      op  setting
  2019-01-04 00:00:00 3480     1140
  2019-01-04 03:00:00 3480     1140
  2019-01-04 10:17:00 3480     1140
  2019-01-04 19:00:00 3480     2340
  2019-01-05 09:00:00 3480     2340
  2019-01-06 10:00:00 4610     4610
  2019-01-07 16:00:00 4610     4610
  2019-01-09 14:50:00 4610      0    
  </code></pre>
  
  <p>The datatype of the result doesn't matter -- seconds/minutes/timedelta. Boundary cases at the end also are not too important. What is the best way to do do this?</p>