Data Formatting
General Info
Useful Snippets

9.0.10 Create a Lagged Feature

Example:

# used to create features from past values.  Take the value from a row, such as that day's price, and shift it down 1 to create 'yesterday price'
# don't forget to sort the data first
df = df.sort_values(by=['date_time_formated'])
df['Letter_above']  = df['Letter'].shift(1)  # include the value you want to shift and the number of days to shift