In [2]:
import pandas as pd
In [6]:
orders = pd.read_table('http://bit.ly/chiporders') #需要翻墙
In [8]:
orders.head()
Out[8]:
In [11]:
pd.read_table('http://bit.ly/movieusers')
Out[11]:
In [15]:
pd.read_table('http://bit.ly/movieusers',sep='|') # 将数据按|进行分隔
Out[15]:
In [18]:
pd.read_table('http://bit.ly/movieusers',sep='|',header=None) # 告诉pandas第一行不是表头
Out[18]:
In [22]:
#给pandas添加表头
user_cols = ['user_id','age','gender','occupation','zip_code'] #occupation n. 职业 zip code 邮编
pd.read_table('http://bit.ly/movieusers',sep='|',header=None, names=user_cols ) # 告诉pandas第一行不是表头
Out[22]:
In [23]:
#给pandas添加表头
user_cols = ['user_id','age','gender','occupation','zip_code'] #occupation n. 职业 zip code 邮编
users = pd.read_table('http://bit.ly/movieusers',sep='|',header=None, names=user_cols ) # 告诉pandas第一行不是表头
In [25]:
users.head()
Out[25]:
In [ ]: