title: how to replace last value to kWh in pandas
body: <p>hi I have a code in pandas (I wanna convert Watt to kWh here):</p>
  
  <pre><code>new = df['datetime;W'].str.split('(;| )',n=2, expand=True)
  df['Date_Time']= new[0]
  df['Watts']= new[2]
  df['Date_Time'] = pd.to_datetime(df['Date_Time'], format='%Y%m%d:%H%M', errors='ignore')
  df['Watts'] = df['Watts'].str.replace(',', '.').astype(float)
  kiloWatt = df.select_dtypes(exclude=['object','datetime']) * 0.001
  df['kWatt'] = kiloWatt['Watts']
  df['kWh']= 'NaN'
  df.drop(columns =['datetime;W', 'Watts'], inplace = True)
     for index, row in df.iterrows():
       if index &lt; len(df)-1:
         df.loc[index,'kWh'] = ((df['kWatt'][index] + df['kWatt'][index+1]) / 2)  *((df['Date_Time'][index+1]-df['Date_Time'][index]).seconds / 3600)
         df['kWh'] = df['kWh'].astype(float)
  df.drop(columns =['kWatt'], inplace = True)'''
  
      date_time        kWh
  2016-12-31 21:55:00  0.0
  2016-12-31 22:55:00  0.0
  2016-12-31 23:55:00  NaN
  </code></pre>
  
  <p>I would like to be able to get value in my last row also but I don't know how!!!???
  And I would like too if it is possible, improve my code (get col:date_time in 30min not 1h) if you have idea. Thanks </p>