Recall the URL with the country data. Let’s use this to practice some preliminary cleaning techniques. import pandas as pd url = 'https://raw.githubusercontent.com/jstaf/gapminder/master/gapminder...
Visualizing with Altair in Python
Matplotlib is a standard package used in Python for plotting. This is a basic plotting package, but does have limitations. If you are familiar with R, you may have used ggplot2 before. In Python, ...
Basic Visualizations in Python
You can use base Python to perform basic visualizations with a dataset. Let’s take a look at a few examples. Let’s re-load in our Gapminder data: import pandas as pd url = 'https://raw.githubuser...
Viewing Data in Python
The Pandas package is the go-to package in Python for data frames and data set analysis. Let’s load in a dataset from a URL and then explore the data. We can enter the URL to the data set and save...
Python Data Types
When we talk about data, we can talk about data types, data classes, and data structures. Data types are fundamental building blocks for storing information. Below, we can see a chart of all of th...
Packages in Python
Since Python is so widely used, there are many people who contribute to continuously improving and developing it. Let’s imagine Python as a base version. It can do basic calculations, but it requir...
Loops in Python
Loops are a common tool used in Python to help users iterate through lists, or perform the same operation numerous times without added efforts. Let’s look at a few examples: # Loops for n in [0,...
Lists in Python
Lists are an important tool used in Python. Lists can contain elements of mixed types as well. Let’s look at a few examples. # List list1 = [] list1 ## [] list2 = [1, 'UBC', 100] list2 ## [1...
Dictionaries in Python
A dictionary lists key-value pairs, which could also be thought of as associated values where a key matches to the associated value. Let’s look at a few examples. # Dictionary - mapping between va...
Defining Functions in Python
Functions take in data and do things with that data. We can write our own functions, but generally in Python we’ll be using functions that have already been written or built. Simple functions can ...