Getting started

You’re welcome to dive in and work as you please, but if you’re feeling at a loss where to begin, follow the scaffold below.

Project scaffold

Step 0: Pick a dataset

We have nine datasets for you to choose from. We recommend saving your data inside your project.

Dataset Description Source
World populations A summary of world populations and corresponding statistics Data from a Tidy Tuesday post on 2014 CIA World Factbook data
Soccer players A summary of approx. 6000 soccer players from 2024 Data from a Kaggle submission.
Coffee survey A survey of blind coffee tasting results Data from a Kaggle submission
Gapminder GDP and life expectancy data by country Data from the Research Bazaar’s R novice tutorial, sourced from Gapminder.
Melbourne housing data A collection of houses for sale in Melbourne. Data from a Kaggle submission
Goodreads books A summary of books on Goodreads. Data from a Kaggle submission
Queensland hospitals Queensland emergency department statistics. Data from the Queensland Government’s Open Data Portal.
Queensland fuel prices Fuel prices by the pump in Queensland Data from the Queensland Government’s Open Data Portal
Aeroplane bird strikes Aeroplane bird strike incidents fron the 90s Data from a Tidy Tuesday post sourced from an FAA database

Remember, to load the data into Python we need to import the pandas module and use the read.csv() function.

import pandas as pd
df = read.csv("path_to_data")

Step 1: Understand the data

The datasets are varied with respect to variable types and content. The first exercise you should complete is a overview of the data. Use the following techniques to do so.

Your goal: identify which variables are discrete (categorical) and which are continuous.

Viewing the data structure

Use the following functions to view your data and the underlying data types.

df.columns
df.info()
df.describe()

Picking out individual columns

To view the contents of particular columns, you can select them via indexing

df["column_name"]
df["column_name"].unique()
df["column_name"].describe()

You can also apply other statistics to the column, like .max().

Step 2: Taking a subset

The datasets have lots of observations for lots of variables. To draw meaningful results, it’s often useful to take a subset of those.

Your goal: filter by a condition or group by and aggregate over a particular variable

Filtering

Recall that filtering looks like indexing. If you only want to examine a certain subset of a variable, the following code will isolate that subset

condition = df["column_to_filter"]...
subset = df[condition]

For example, if you only want “Australia” for a dataset with a “country” column, you might use

condition = df["country"] == "Australia"

Grouping

If you want to aggregate over a particular variable you need to group by it. This answers questions like, what is the average \(x\) for every \(y\).

If you want to group by a column and, for each of its values, apply a statistic to all the others,

summary = df.groupby("column_to_group_by").agg("statistic")

If you only want to apply aggregation to some columns, we can pick them out

summary = df.groupby("column_to_group_by")["column_to_aggregate"].agg("statistic")

Hint: if you want to visualise the grouping variable, you might want to use df.groupby("column", as_index = False)... to keep it as a column

Step 3: Visualise the relationship between variables

With your summary dataset, you can now try to visualise your variables.

Your goal: create a visualisation of one to three variables in your summary data.

First, you need to import the seaborn module

import seaborn as sns

Next, you’ll need to identify the variables to visualise. If they’re both continuous, you could use a scatter or line plot

sns.relplot(data = summary, x = ..., y = ..., kind = ..., ...)

If one of them is categorical, you could use a barplot or boxplot

sns.catplot(data = summary, x = ..., y = ..., kind = ..., ...)

You could also consider a histogram, looking at one continuous variable

sns.displot(data = summary, x = ..., ...)

Step 4: Looking ahead

Now that you’ve performed your first analysis and visualisation of the dataset, use these results to inform your next analysis!

Below you’ll find some general tips which can help. They have dataset-specific tips too, so check them out. Otherwise, feel free to ask if you have any other questions.