Member-only story
How to read CSV data from a URL into a Pandas DataFrame
Documentation for importing data from a raw CSV with Pandas, Python and Jupyter notebook
The fields of Data Analysis and Data Science are all about getting data and then going something with it.
In today’s tutorial, we’ll explore one of the many ways to “get data”: reading a raw CSV into our Jupyter notebook using the CSV github URL.
Table of Contents
- Set up notebook
- Get data
- Do something with data
Step 1: Set up notebook
Setting up our notebook for this task couldn’t be easier. All we need is Pandas:
import pandas as pd
Easy.
Step 2: Get data
If you’ve ever read a CSV from local storage into your Jupyter notebook, this is going to be a breeze for you. It’s the exact same process. Except instead of passing in a path to the file on your computer, you’ll pass in the URL to the raw CSV.
For this example, we’re going to use a raw CSV of US State-county-zip data from github.com: https://github.com/scpike/us-state-county-zip/blob/master/geo-data.csv