I have following dataframe:
time u10 ... tsn tp
longitude latitude ...
20.0 45.0 2014-01-01 00:00:00 2.595551 ... 272.453827 0.000014
45.0 2014-01-01 01:00:00 2.615493 ... 273.159973 0.000000
45.0 2014-01-01 02:00:00 2.587403 ... 273.122192 0.000000
45.0 2014-01-01 03:00:00 2.528865 ... 273.050903 0.000000
45.0 2014-01-01 04:00:00 2.556740 ... 272.772491 0.000000
I want to subtract neighboring records of column u10 for all values of column time,except one value of column time ( where time ends with 00:00:00 )
I need following output:
time u10 ... tsn tp
longitude latitude ...
20.0 45.0 2014-01-01 00:00:00 2.595551 ... 272.453827 0.000014
45.0 2014-01-01 01:00:00 0.019942 ... 273.159973 0.000000
45.0 2014-01-01 02:00:00 -0.02809 ... 273.122192 0.000000
45.0 2014-01-01 03:00:00 -0.058538 ... 273.050903 0.000000
I can do df.loc combining with df['time'].shift()-df['time'] but that will work for all record.
How can I make this work with desired output?
P.S. I am looking for vectorized solution.