Created
March 9, 2021 00:10
-
-
Save brianspiering/39a3700aae628a161e1d75af538873a4 to your computer and use it in GitHub Desktop.
Look for local data. If not found, download it.
This file contains hidden or 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
import pandas as pd | |
filename = 'loans.csv' | |
remote_location = 'https://raw.githubusercontent.com/DeltaAnalytics/machine_learning_for_good_data/master/' | |
try: | |
# Local version | |
df = pd.read_csv(filename) | |
except FileNotFoundError or ParserError: | |
# Grab the remote file and save it | |
url = remote_location+filename | |
df = pd.read_csv(url) | |
df.to_csv(filename) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment