Skip to content
RED SAG Skills
mediumStudy question · answer published in Pandas interview questions, so no pointsmachine-learningfeature-engineeringtime-series

Building a lag feature

You forecast tomorrow's demand. Which lag feature is safe to use?

df = df.sort_values('date')
# option A
df['lag_1'] = df['demand'].shift(1)
# option B
df['lead_1'] = df['demand'].shift(-1)
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions