Reading data from GitHub in Pandas
To read data from a GitHub page in Pandas, supply the URL to the
import pandas as pdurl = "https://raw.githubusercontent.com/SkyTowner/sample_data/main/pandas/simple_dataset.csv"df = pd.read_csv(url)dfA B C0 1 2 31 4 5 62 7 8 9
Notice how the URL begins with
raw. In order to retrieve this URL, visit the GitHub page containing your dataset. In our case, this is as follows:
Next, click on the "Raw" button at the top in order to get the plain CSV file.