This is a free preview. Enrol on the course to save your progress and open every lesson.

Lesson 3 of 32 · 20 min

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.

FileWhat's in itUsed in
trips.csvEvery hire in 2025: about 5,600 rowsEvery module
stations.csvThe 20 stations: name, suburb, docks, locationEvery module
weather.csvEach day's top temperature and rainModules 3, 6, 7
feedback.json300 rider comments and ratingsModules 4, 7, 8
candidate_sites.csvEight places the council could put a new stationModules 7, 8
trips_clean.csvThe trips after you clean them in Module 5Modules 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.

  1. Open the Module 1 notebook in Google Colab and sign in with a Google account.
  2. Click Copy to Drive at the top, so your changes are saved in your own Google Drive.
  3. 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_idstart_timeend_timestart_stationend_stationrider_typemember_idbike_typedistance_kmduration_min
0T1000012025-01-01 05:482025-01-01 06:17HC07HC19memberM1321classic5.629.0
1T1000022025-01-01 06:032025-01-01 06:16HC18HC01casualNaNclassic0.513.0
2T1000032025-01-01 07:002025-01-01 07:10HC03HC01memberM1418classic1.410.0
3T1000042025-01-01 09:532025-01-01 10:40HC15HC10casualNaNclassic7.047.0
4T1000052025-01-01 09:562025-01-01 10:03HC17HC04memberM1337classic1.37.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_idnamesuburbdockslatitudelongitudeopened
0HC01Harbour WharfHarbourside24-34.4012150.90212021-03-01
1HC02Ferry TerminalHarbourside20-34.3988150.89842021-03-01
2HC03Town HallOld Town18-34.4061150.89322021-03-01
3HC04Market SquareOld Town16-34.4079150.89672021-03-01
4HC05Library LaneOld Town12-34.4096150.89112022-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

  1. Load weather.csv into a variable called weather, then show its first five rows and its shape. How many days does it cover?
  2. Count the stations in each suburb with stations["suburb"].value_counts(). Which suburb has the most?
  3. Run trips.tail(). What does it show, and what date is the last trip?

Downloads

2 files to download once you enrol.