Sitemap
Image by Dariusz Sankowski from Pixabay

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

3 min readMar 17, 2022

--

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

  1. Set up notebook
  2. Get data
  3. 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

--

--

David Allen
David Allen

Written by David Allen

Documentation and tutorials on Python, Pandas, Jupyter Notebook, and Data Analysis.

No responses yet