# Load library
import pandas as pd

"""
Explanation: Title: Rolling Time Window
Slug: rolling_time_windows
Summary: How to use rolling time windows in pandas for machine learning in Python.   
Date: 2017-09-11 12:00
Category: Machine Learning
Tags: Preprocessing Dates And Times  
Authors: Chris Albon
Preliminaries
End of explanation
"""


# Create datetimes
time_index = pd.date_range('01/01/2010', periods=5, freq='M')

# Create data frame, set index
df = pd.DataFrame(index=time_index)

# Create feature
df['Stock_Price'] = [1,2,3,4,5]

"""
Explanation: Create Date Data
End of explanation
"""


# Calculate rolling mean
df.rolling(window=2).mean()

# Identify max value in rolling time window
df.rolling(window=2).max()

"""
Explanation: Create A Rolling Time Window Of Two Rows
End of explanation
"""


