A quick post today. I’ve had to pull some files from my work github repository to run analysis. In case you run into that challenge, the requests module in python offers a simple solution to the problem. I may update this post in the future with an SSH connection to github but for now, here’s what I did.
# Import necessary modules
import requests
import io
import pandas as pd
# Connect to git file
req = requests.get('https://raw.githubusercontent.com/GitRepoName/FolderName/FileName.csv', auth=('yourgitusername', 'yourgitpassword')).content
# Convert file into a dataframe
data = pd.read_csv(io.StringIO(req.decode('utf-8')))
Voila!