Practice / aggregations

Daily Ride Count

easy

CityCycle, the city bike-share, wants to know how busy each day was.

You have the rides DataFrame:

Your task: return one row per ride_date with a column num_rides giving the total number of rides taken that day. (Some rides have a missing station — they still count.)

Assign your answer DataFrame to result. Row order doesn't matter.

ridesinput DataFrame

Schema
columntype
ride_idlong
ride_datestring
stationstring
Sample rows
ride_idride_datestation
12026-06-01Harbor
22026-06-01Elm St
32026-06-01Harbor
42026-06-02Elm St
52026-06-02null
62026-06-03Harbor
Expected output shape
ride_datenum_rides· 3 rows
Hint

groupBy("ride_date") then agg(F.count("*").alias("num_rides")). Count the rows on each day — count("*") counts every row, even ones with missing fields.

Lesson refresher

This problem builds on Aggregations & groupBy (~7 min). Pop it open in a new tab if you want a quick recap.

Loading editor…
Hit Run to execute your code and see the output here.