Home
R & Python Blog
Cancel

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 ...

Introduction to R

R can be used as a generic calculator. 1 + 1 ## [1] 2 2-3 ## [1] -1 6 / 2 ## [1] 3 3 * 4 ## [1] 12 Since R is so widely used, there are many people who contribute to continuously i...

Reading Data in Python

CSV File Using the Pandas library, it is very easy to open a CSV file using Python. Simply import the package, and then use the line pd.read_csv(). See this example below: import pandas as pd df ...