Created
February 1, 2021 13:04
-
-
Save john-adeojo/7ba64dfb30896b14e2f24f7711b98330 to your computer and use it in GitHub Desktop.
Reads CSV from GitHub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# THIS FUNCTION TAKES A CSV FILE FROM A GITHUB URL AND READS IT INTO A PANDAS DATA FRAME | |
import pandas as pd | |
def read_file(url): | |
""" | |
Takes GitHub url as an argument, | |
pulls CSV file located @ github URL. | |
""" | |
url = url + "?raw=true" | |
df = pd.read_csv(url) | |
return df | |
# READ FILE FROM GITHUB REPO | |
# CHANGE THE URL TO YOUR DATA LOCATION! | |
url = "https://github.com/john-adeojo/deploy_notebook_example/blob/main/kids.csv" | |
kids= read_file(url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment