For reading a csv datasets from a GitHub repository:
- Open the GitHub repository page in your web browser.
- Click on the dataset file you want to read from the GitHub repository. A preview of the file will open.
- You will find a "Raw" button to the upper right corner of the file preview. Click on it.
- The file preview will open with a URL like this: https://raw.githubusercontent.com/insaid......
- Copy this URL and paste in pd.read_csv() to read it.
An example of reading a csv dataset in pandas:
import pandas as pd
df = pd.read_csv('https://raw.githubusercontent.com/insaid2018/Term-1/master/Data/Casestudy/titanic_train.csv')
df.head()
Comments
0 comments
Article is closed for comments.