E ExamMaster

Data Science · Data Science Core

Time series

In Data Science because some questions are a value over dates — the shop till each day — and you read trend and weekend season in pandas, not as an ARIMA elective.

A time series is one number lined up on dates. Rao's till for two weeks is 400, 420, 380, 450, 900, 1100, 800 then 410, 430, 390, 460, 920, 1080, 820. Week 1 sums to Rs 4450; week 2 to Rs 4510. You will read the weekend bump and the slight rise — not fit a forecast model.

  • Data Science
  • Medium level
  • 4 concepts

1One value, lined up on dates

A time series is not 'any table with a date column'. It is one measured thing — here, till in rupees, the money in the drawer at closing — written in date order, one row per day. Two weeks is fourteen rows, not eight customers. The customer sheet can be sorted by spend. The till series cannot, or Saturday stops being after Friday.

Week 1, Monday through Sunday, is 400, 420, 380, 450, 900, 1100, 800. Add them and the week is Rs 4450. If you shuffle those seven numbers by size, the series is gone: you still have the same rupees, but you no longer have 'over time'.

Figure. Week-1 till in day order: Mon 400 through Sat 1100 and Sun 800. The seven heights are the series. Shuffle them by size and Saturday is no longer after Friday.

Week 1 till (Rs)
daytill
Mon400
Tue420
Wed380
Thu450
Fri900
Sat1100
Sun800

Week 1 from the daily till

Monday through Sunday till is 400, 420, 380, 450, 900, 1100, 800. What is the week total?

  • 400 + 420 + 380 + 4501650
  • 1650 + 900 + 1100 + 8004450

Pro tip. The 4450 is a sum of days in order. It is not eight customers.

Coding lab. Sum week 1 in day order runs in the app, with checks on your output.

What makes Rao's till a time series rather than the customer sheet?
  1. One value (till) in date order, one row per day
  2. It has eight people in it
  3. It is ready for sklearn

People can be reordered. Days cannot if the question is 'over time'.

2The slow rise versus the weekend bump

Put the two week totals next to each other before you reach for a word. Week 1 is Rs 4450. Week 2 is 410 + 430 + 390 + 460 + 920 + 1080 + 820 = 4510. That is a rise of Rs 60 on a Rs 4450 week — a small lift, not a leap. The slow change from one week to the next is what people call a trend.

Now look at the same weekday across the two weeks. Saturday is 1100 then 1080. Sunday is 800 then 820. Monday is 400 then 410. The Saturday jump happens both weeks, then Monday falls back near 400. A bump that repeats every weekend, then drops, is what people call season here — not a forecast word, just 'the shape that comes back'. Do not call the Saturday spike a trend. A trend would keep climbing through next Monday.

Figure. Saturday stays the peak both weeks (1100 then 1080). Monday stays near 400 both weeks (400 then 410). The weekend bump repeats; the week-total lift of Rs 60 is the slow rise.

Two weeks, same shape
pieceweek 1week 2
week total (Rs)44504510
Saturday11001080
Sunday800820
Monday400410

Week totals from the daily till

Week 1 days are 400, 420, 380, 450, 900, 1100, 800. Week 2 days are 410, 430, 390, 460, 920, 1080, 820. What is each week total, and what is the rise?

  • 400+420+380+450+900+1100+8004450
  • 410+430+390+460+920+1080+8204510
  • 4510 - 445060

Pro tip. A Rs 60 rise on a Rs 4450 week is a slight trend. Saturday jumping to 1100 both weeks is the repeating bump.

Coding lab. Week totals side by side runs in the app, with checks on your output.

Saturday is 1100 then 1080. Monday is 400 then 410. What is the Saturday jump?
  1. Season — it repeats both weeks, then Monday falls back
  2. Trend — the shop only ever goes up
  3. A missing-value code

A bump that returns every weekend is season. Trend is the small week-total lift.

3A small pandas path

Put the dates in a column, sort them, then mark which days are Saturday and Sunday. pandas numbers weekdays from Monday: Monday is 0, Tuesday is 1, Wednesday 2, Thursday 3, Friday 4, Saturday 5, Sunday 6. So 'the weekend' is the days whose number is 5 or 6 — written dayofweek >= 5. That flag is a yes/no on each day, not a model.

Add till inside that flag and you recover the weekend-versus-weekday story from the same seven (or fourteen) rows. Week 1 weekdays are 400 + 420 + 380 + 450 + 900 = 2550. Saturday plus Sunday is 1100 + 800 = 1900. Two weekend days hold 1900 of the 4450 week. You do not need a forecast package or a twenty-page elective.

Figure. Week-1 weekdays sum to 2550; Saturday plus Sunday is 1900. Two weekend days hold 1900 of the 4450 week. dayofweek >= 5 is that flag.

Weekend vs weekday till

import pandas as pd
days = pd.date_range('2026-01-05', periods=7, freq='D')
till = [400, 420, 380, 450, 900, 1100, 800]
s = pd.Series(till, index=days)
weekend = s.index.dayofweek >= 5
print(int(s[weekend].sum()), int(s[~weekend].sum()))

Week-1 weekend versus weekday till

Week 1: Mon–Fri are 400, 420, 380, 450, 900. Sat–Sun are 1100, 800. What is each sum?

  • 400+420+380+450+9002550
  • 1100+8001900
  • 2550 + 19004450

Pro tip. Two weekend days hold 1900 of the 4450 week — the repeating bump, not a model.

Coding lab. Flag the weekend runs in the app, with checks on your output.

In pandas, which test flags Saturday and Sunday when Monday is day 0?
  1. dayofweek >= 5
  2. dayofweek == 0
  3. A train/test split on random rows

Monday is 0, Sunday is 6. Weekend is 5 and 6.

4Lab: weekend till

Build the seven-day week-1 series and print the weekend sum. days is a Monday-to-Sunday date range starting 2026-01-05. till is the seven rupee amounts you already added by hand. dayofweek >= 5 flags Saturday (5) and Sunday (6). The check looks for 1900 — Saturday 1100 plus Sunday 800.

This course stops after that sum because the question was the repeating bump, not a twenty-page forecast. You have not held out a test fold and you have not fitted a model. You have added the two weekend days.

No diagram — the weekend sum is printed by the coding lab.

Lab checklist
StepWhy
Index the seven amounts by dateMonday is day 0 in that index
Flag dayofweek >= 5Saturday is 5, Sunday is 6
Print the weekend sumThe check looks for 1900

Coding lab. Sum the weekend till runs in the app, with checks on your output.

Why does this course stop after the weekend sum?
  1. The question was the repeating bump, not a 20-page forecast
  2. ARIMA is illegal in pandas
  3. 1900 is a test-set accuracy

Read the series. Forecasting electives live elsewhere.

Notes

  • In Data Science because some questions are a value over dates — the shop till each day — and you read trend and weekend season in pandas, not as an ARIMA elective.
  • A time series is not any table with a date column. It is one measured thing — till in rupees — in date order, one row per day. Two weeks is fourteen rows, not eight customers.
  • Week 1 totalling Rs 4450 and week 2 totalling Rs 4510 is a small rise. Saturday is 1100 then 1080 both weeks — a bump that repeats, then Monday falls back.

Exam traps & shortcuts

  • Name the question before you open the sheet — a table without a question is just a dump.
  • A number is a claim only when you can point at the rows that produced it.

Recap

Dates in order, then the slow rise versus the weekend bump, then a pandas group of weekday versus weekend.

One value, lined up on dates
Till in rupees, one row per day, in date order. Two weeks is fourteen rows. Shuffle the days and Saturday is no longer after Friday.
The slow rise versus the weekend bump
Week totals 4450 then 4510 — a Rs 60 rise. Saturday 1100 then 1080, Monday 400 then 410 — the weekend bump repeats, then Monday falls back.
A small pandas path
Monday is day 0, Saturday is 5, Sunday is 6. Flag days 5 and 6, then add till inside that flag. Week 1 weekend is 1900.
Lab: weekend till
Print Saturday 1100 plus Sunday 800. The check looks for 1900. No forecast model.

Practise Time series

Reading is free and needs no account. Practice, mocks and progress live in the app.

  • A 3-question practice set that ends the chapter
  • 4 quick checks with worked explanations
  • Timed mocks scored with the real marking scheme
  • Readiness tracked per topic, kept on your device
Continue with Google — freeNo card, no trial. Works offline once installed.