Create lag features for time series
Engineer time series features
Paste in your AI
Paste this prompt in ChatGPT, Claude or Gemini and customize the variables in brackets.
Write Python code to create lag features and rolling statistics for a time series DataFrame with columns [list columns] and a datetime index. Create lags of [1, 3, 7, 14, 28] periods, rolling mean/std/min/max for windows of [7, 14, 28] days, and ewm features. Handle NaN values from lagging correctly.
Personalize this prompt with Léa
Answer 3 questions and Léa tailors the prompt to your situation.
Use Cases
Learn more
Check the full skill on Prompt Guide to master this technique from A to Z.
View on Prompt Guide📬 Get new prompts every week
Join our newsletter and never miss a prompt.
Similar Prompts
Multichannel marketing data analysis
Complete multichannel marketing performance analysis with ROI calculation, attribution models, and budget optimization.
Choose the right visualization for your data
Guide the choice of optimal chart type based on data, audience, and message to communicate.
Web analytics metrics analysis
Comprehensive web analytics metrics analysis to understand visitor behavior and identify optimization areas.
Create your first dashboard in Excel
Step-by-step guide to create your first professional Excel dashboard with no advanced knowledge required.