Group, rollup, index, bin and format
Monthly totals match the real file: Jul 117,803 is the busiest month. The bin counts add up to all 365 days.
Charts show summaries: totals, averages, the busiest day, counts per month, how many days fall in each range. d3-array gives short, tested functions for these, and you must know what each returns for empty, missing and text input.
Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.
Ready for more? This phase has 5 hands-on exercises with automatic checks.
Practice questions
Write the code in the editor, run it, then open the model answer to compare.
Using daily.csv and d3.rollup, find the month with the most rides and print its name and total.
Write summary(values) that returns { count, min, median, max } and returns null for an empty array.
Explain it without notes
What does d3.mean([]) return, and what should a dashboard show then?
What is the difference between d3.group and d3.rollup?
Why can d3.sum be right and d3.max wrong on the same array of strings?
Console
(nothing was printed)Expected console output
Rides per month: Jan 43,439 | Feb 44,343 | Mar 60,928 | Apr 78,970 | May 99,946 | Jun 107,712 | Jul 117,803 | Aug 108,806 | Sep 92,354 | Oct 76,485 | Nov 57,489 | Dec 45,376
Average rides per weekday: Mon 2682 | Tue 2723 | Wed 2598 | Thu 2556 | Fri 2771 | Sat 2283 | Sun 2292
Rainy days: 108 | dry days: 257
Lookup 2025-08-14: 439 rides | missing key: undefined
Top 3 days: 2025-07-18 4380 | 2025-08-06 4309 | 2025-07-15 4302 | input still in date order: 2025-01-01
439 to 500: 1
500 to 1000: # 3
1000 to 1500: ############### 45
1500 to 2000: ############################ 85
2000 to 2500: ################ 49
2500 to 3000: ################# 50
3000 to 3500: ################## 55
3500 to 4000: ################ 49
4000 to 4380: ######### 28
Days counted in bins: 365
d3.format(','): 933,651 | d3.format('~s'): 933.651k | d3.format('.1%'): 28.6%
en-GB: 933,651 | en-IN: 9,33,651 | de-DE: 933.651