Reputation: 786
I am working on a pandas tutorial and want to load the following data to a dataframe (I am using python 3.6 and pandas 0.23.0):
I know how to load data from the standard data formats (csv, excel, etc.) but have now clue how to handle the data at hand. (There probably is an easy solution (maybe already on SO?), but so far I found none as I don't even know what I am looking at exactly).
Upvotes: 2
Views: 420
Reputation: 4607
have you tried this
df = pd.read_csv('https://raw.githubusercontent.com/justmarkham/DAT8/master/data/u.user',sep ='|')
Upvotes: 1
Reputation: 862511
Simply use read_csv
, which working with url link to data very nice:
url = 'https://raw.githubusercontent.com/justmarkham/DAT8/master/data/u.user'
df = pd.read_csv(url, sep='|')
print (df.head())
user_id age gender occupation zip_code
0 1 24 M technician 85711
1 2 53 F other 94043
2 3 23 M writer 32067
3 4 24 M technician 43537
4 5 33 F other 15213
Upvotes: 2