自己尝试了一下数据分析,和书里的方法不完全一样。标*的为比较好的方法。
================================================
MovieLens电影评分数据分析¶
In [8]:
path = 'C:\\Users\\yi&lei\\Documents\\电子书\\pydata-book-1st-edition\\pydata-book-1st-edition\\ch02\\movielens'
a = path + '\\movies.dat'
b = path + '\\ratings.dat'
c = path + '\\users.dat'
a
Out[8]:
In [20]:
import pandas as pd
mnames = ['movieid','title','genres']
movie = pd.read_table(a,sep='::',header=None,names = mnames,engine='python')
In [21]:
movie.head()
Out[21]:
In [17]:
unames = ['userid','gender','age','occupation','zip']
user = pd.read_table(c,sep='::',header=None,names = unames,engine='python')
user.head()
Out[17]: