…
…
Explore two years of daily bike rentals by season, day of the week, temperature and rain, and describe the patterns with numbers using time series tools.
The city's bike-sharing system has combined two years of daily rental counts with weather records. The city council wants to plan how many bikes each station gets and when to schedule maintenance, so it asks what drives rentals: the season, the temperature, rain, or the weekend?
Data: bike_rentals.csv, one row for each day from January 1, 2024 to December 31, 2025.
| Column | Description |
|---|---|
date | Day |
temp_c | Daily average temperature (°C) |
rain_mm | Daily rainfall (mm) |
wind_kmh | Average wind speed (km/h) |
holiday | Public holiday (1/0) |
rentals | Number of rentals that day |
Lessons used: new columns and dates (8), grouping and pivot tables (9–10), grouping with pd.cut (16), central tendency (17), choosing charts and exploratory analysis (20–22), time series (38).
This is an exploratory analysis project: the goal is not to test a hypothesis but to see the patterns and describe them with numbers.
What you'll do
bike_rentals.csvDownload file
Reading file…
Code cells are for members
You can read the steps. Sign up free to run the code, complete the steps and save your progress.
Time series tools (resample, rolling) need a date index. Read the file with dates parsed and make the date column the index. Then check how many days there are, the first and last day, and a summary of the main columns.
This step's code cell is for members.Sign up free
Add up the daily data by month with resample("MS") and show it as a line chart. Then compare the yearly totals and work out the growth in 2025.
A line chart's y-axis does not have to start at zero, but here we start it at zero so the size of the seasonal gap is shown honestly.
This step's code cell is for members.Sign up free
People use bikes for both getting around and fun. Work out the average rentals for each day of the week (Monday is 0). Then compare weekends with weekdays, and holidays that fall on a weekday with normal weekdays.
Code cells are for members
You can read the steps. Sign up free to run the code, complete the steps and save your progress.
Write the weekend and holiday effects as a percentage: weekend average / weekday average − 1.
This step's code cell is for members.Sign up free
Split the temperature into 5-degree groups and work out the average rentals for each group. Then plot rentals against temperature in a scatter plot.
Do rentals keep rising with temperature? What happens above 25 degrees? Look in this table for the reason July comes out lower than June.
This step's code cell is for members.Sign up free
Split rainfall into three groups: dry (up to 1 mm), light (1–8 mm) and heavy (over 8 mm). Use a pivot table of rain group × weekend to get the average rentals.
Which brings more rentals: a rainy weekend or a dry weekday?
This step's code cell is for members.Sign up free
Daily series are noisy. In the top chart, plot daily rentals and the 28-day moving average together. In the bottom chart, show the average for each day of the week as bars.
When a series has seasonality, compare each month with the same month last year, not with other months: pct_change(12) is the change of the monthly series from 12 months earlier. Finally, write your findings in three lines.
This step's code cell is for members.Sign up free