Sliding window time series data with Python Pandas data frame I have data that looks like:

 1495573445.162, 0, 0.021973, 0.012283, -0.995468, 1
 1495573445.172, 0, 0.021072, 0.013779, -0.994308, 1
 1495573445.182, 0, 0.020157, 0.015717, -0.995575, 1
 1495573445.192, 0, 0.017883, 0.012756, -0.993927, 1
 1495573445.202, 0, 0.021194, 0.012161, -0.994705, 1
 1495573445.212, 0, 0.019638, 0.013718, -0.994019, 1
 1495573445.222, 0, 0.019440, 0.010803, -0.994476, 1
 1495573445.232, 0, 0.018112, 0.010849, -0.993073, 1
 1495573445.242, 0, 0.020157, 0.011154, -0.994644, 1
 1495573445.252, 0, 0.020340, 0.010040, -0.995804, 1
 1495573445.262, 0, 0.017792, 0.009857, -0.996078, 1
 1495573445.272, 0, 0.020538, 0.010239, -0.994858, 1


This is accelerometer data where the data frame columns are labeled "Time stamp", "Time skipped", "x", "y", "z", and "label" with the index set to "Time stamp". 

The sampling rate is around 100Hz. How should I create a sliding window in this case? 

I came up with this:

def sliding_window(data, window_size, step_size):
    data = pd.rolling_window(data, window_size)
    data = data[step_size - 1 :: step_size]
    print data
    return data


I doubt this is the correct answer, and I don't know what to set window_size and step_size given that I have a 100Hz sampling rate.
You can use the built-in Pandas functions to do it:

df["Time stamp"] = pd.to_datetime(df["Time stamp"]) # Convert column type to be datetime
indexed_df = df.set_index(["Time stamp"])           # Create a datetime index
indexed_df.rolling(100)                             # Create rolling windows
indexed_df.rolling(100).mean()                      # Then apply functions to rolling windows


This code is not 100% correct because the datetime conversion is not correct but it should help you get started.