Meet Harbour City Bike Share and your first notebook
Meet Harbour City Bike Share
Harbour City Bike Share has 20 stations in seven suburbs. Riders unlock a bike at one station and dock it at another. Members pay a yearly fee; casual riders pay per trip. About a third of the bikes are electric.
The council has given you one year of data (2025) and a question: where should the next three stations go, and is the scheme worth growing? Harbour City and all its data are made up for this course, but they behave like the real thing, including the mistakes.
| File | What's in it | Used in |
|---|---|---|
trips.csv | Every hire in 2025: about 5,600 rows | Every module |
stations.csv | The 20 stations: name, suburb, docks, location | Every module |
weather.csv | Each day's top temperature and rain | Modules 3, 6, 7 |
feedback.json | 300 rider comments and ratings | Modules 4, 7, 8 |
candidate_sites.csv | Eight places the council could put a new station | Modules 7, 8 |
trips_clean.csv | The trips after you clean them in Module 5 | Modules 6, 7, 8 |
Open your first notebook
A notebook is a page that mixes notes and code. You run the code one block (a cell) at a time and the result appears underneath. Data scientists use notebooks because you can see each step and its result together.
- Open the Module 1 notebook in Google Colab and sign in with a Google account.
- Click Copy to Drive at the top, so your changes are saved in your own Google Drive.
- Click in the first grey code cell and press Shift + Enter to run it. The first run takes a few seconds while Colab starts.
Each module has its own notebook, linked in its lessons. There's an answers notebook for each one too, in the starter files download attached to this lesson. The starter files also include all the data, if you'd rather work without an internet connection.
Load the trips
We use pandas, the most popular Python library for tables of data. The first cell loads it, along with matplotlib for charts, then reads the trips file straight from the web:
import pandas as pd
import matplotlib.pyplot as plt
# The Harbour City Bike Share data. Using the zip instead? Upload the data folder and use DATA = "data/"
DATA = "https://raw.githubusercontent.com/avro-academy/course-materials/main/data-science/starter/data/"
trips = pd.read_csv(DATA + "trips.csv")
trips.head()
Result:
| trip_id | start_time | end_time | start_station | end_station | rider_type | member_id | bike_type | distance_km | duration_min | |
|---|---|---|---|---|---|---|---|---|---|---|
| 0 | T100001 | 2025-01-01 05:48 | 2025-01-01 06:17 | HC07 | HC19 | member | M1321 | classic | 5.6 | 29.0 |
| 1 | T100002 | 2025-01-01 06:03 | 2025-01-01 06:16 | HC18 | HC01 | casual | NaN | classic | 0.5 | 13.0 |
| 2 | T100003 | 2025-01-01 07:00 | 2025-01-01 07:10 | HC03 | HC01 | member | M1418 | classic | 1.4 | 10.0 |
| 3 | T100004 | 2025-01-01 09:53 | 2025-01-01 10:40 | HC15 | HC10 | casual | NaN | classic | 7.0 | 47.0 |
| 4 | T100005 | 2025-01-01 09:56 | 2025-01-01 10:03 | HC17 | HC04 | member | M1337 | classic | 1.3 | 7.0 |
A DataFrame is pandas' word for a table. head() shows the first five rows. The bold numbers on the left (0 to 4) are the index: pandas' own row numbers. Already you can read a trip: trip T100001 left Science Park (HC07) at 5:48 on New Year's Day and finished at Botanic Gardens (HC19) 29 minutes later. NaN means "nothing here": casual riders have no member ID.
How big, and what kinds?
trips.shape
Result:
(5601, 10)
5,601 rows and 10 columns. Now the kind of data in each column:
trips.dtypes
Result:
trip_id object
start_time object
end_time object
start_station object
end_station object
rider_type object
member_id object
bike_type object
distance_km float64
duration_min float64
dtype: object
float64 means numbers with decimals. object usually means text. Look at start_time: pandas has read it as text, not as a date. That matters later. Lesson 1.2's kinds of data show up here: distance_km is quantitative, rider_type and bike_type are categorical, and the times are dates stored as text for now.
stations = pd.read_csv(DATA + "stations.csv")
stations.head()
Result:
| station_id | name | suburb | docks | latitude | longitude | opened | |
|---|---|---|---|---|---|---|---|
| 0 | HC01 | Harbour Wharf | Harbourside | 24 | -34.4012 | 150.9021 | 2021-03-01 |
| 1 | HC02 | Ferry Terminal | Harbourside | 20 | -34.3988 | 150.8984 | 2021-03-01 |
| 2 | HC03 | Town Hall | Old Town | 18 | -34.4061 | 150.8932 | 2021-03-01 |
| 3 | HC04 | Market Square | Old Town | 16 | -34.4079 | 150.8967 | 2021-03-01 |
| 4 | HC05 | Library Lane | Old Town | 12 | -34.4096 | 150.8911 | 2022-08-15 |
The start_station column in the trips holds a station_id from this table. That link between two tables is the idea behind databases, in Module 4.
Try it
- Load
weather.csvinto a variable calledweather, then show its first five rows and its shape. How many days does it cover? - Count the stations in each suburb with
stations["suburb"].value_counts(). Which suburb has the most? - Run
trips.tail(). What does it show, and what date is the last trip?
Downloads
2 files to download once you enrol.
