Time Series Analysis Basics
Part of the Data Analyst Roadmap
In short
Sales data isn't just numbers, it's numbers in order. Time adds trend, seasons and sudden shocks, and comparing this October with last October usually tells you more than comparing it with September.
Analyzing data points ordered over time — trend, seasonality, and noise — the foundation for any forecasting or 'is this metric actually growing' question.

Think of it like this
A chai stall through the day
The chai wala knows the rush: busy at 8 AM, quiet after lunch, busy again at 5. Over the years, the crowd grows too. That daily rhythm is seasonality, the slow growth is trend, and a random rainy day is noise. Time series analysis separates the three.
Watch it happen
Monthly orders, April to November
1/5Eight months of orders in thousands. Read left to right, it's a story in time order.
The big ideas
What you need to know
Trend
The long-run direction, up, down or flat. Rolling averages smooth noise so you can see it.
Seasonality
Patterns that repeat on a calendar: weekends, month-end salary days, festivals, exam season.
Year-over-year
Comparing the same period across years removes seasonality from the comparison.
Shocks and breaks
Lockdowns, price changes or an app outage. Mark them, or your trend will lie.
See it in code
Walk through the code
1s = (2 df.set_index("order_date")["orders"]3 .resample("MS").sum()4)5 6trend = s.rolling(3).mean()7yoy = s.pct_change(12)8 9from statsmodels.tsa.seasonal import seasonal_decompose10parts = seasonal_decompose(s, model="additive", period=12)11parts.plot()1/4Put dates in the index and add up orders per calendar month. MS means month start.
Monthly totals, a 3-month rolling average, year-over-year growth and a trend plus season breakdown. Decomposition needs at least two full years.
Save yourself the pain
Common mistakes
Oops
Reporting 'November is up 6% on October' as great news.
Do this instead
Festive months are always higher. Compare with last November to see actual growth.
Oops
Leaving missing months out, so the series silently skips time.
Do this instead
Resample to a regular frequency so gaps show up as zeros or NaN that you can handle.
Your mission
Find the seasons
Quick check
A gift shop's December sales are always the highest. What's the fairest way to judge this December?
Go deeper
- 1Plot a time series and visually identify trend versus seasonal patterns.
- 2Learn the difference between a trend, a seasonal pattern, and pure noise.
- 3Try a simple moving average to smooth out noise in a noisy time series.
More topics at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.