def movielens100k(data_set='<STR_LIT>'):
if not data_available(data_set):<EOL><INDENT>import zipfile<EOL>download_data(data_set)<EOL>dir_path = os.path.join(data_path, data_set)<EOL>zip = zipfile.ZipFile(os.path.join(dir_path, '<STR_LIT>'), '<STR_LIT:r>')<EOL>for name in zip.namelist():<EOL><INDENT>zip.extract(name, dir_path)<EOL><DEDENT><DEDENT>import pandas as pd<EOL>encoding = '<STR_LIT>'<EOL>movie_path = os.path.join(data_path, '<STR_LIT>', '<STR_LIT>')<EOL>items = pd.read_csv(os.path.join(movie_path, '<STR_LIT>'), index_col = '<STR_LIT:index>', header=None, sep='<STR_LIT:|>',names=['<STR_LIT:index>', '<STR_LIT:title>', '<STR_LIT:date>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>''<STR_LIT:s>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'], encoding=encoding)<EOL>users = pd.read_csv(os.path.join(movie_path, '<STR_LIT>'), index_col = '<STR_LIT:index>', header=None, sep='<STR_LIT:|>', names=['<STR_LIT:index>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT:id>'], encoding=encoding)<EOL>parts = ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>','<STR_LIT>', '<STR_LIT>','<STR_LIT>', '<STR_LIT>','<STR_LIT>', '<STR_LIT>','<STR_LIT>', '<STR_LIT>','<STR_LIT>', '<STR_LIT>']<EOL>ratings = []<EOL>for part in parts:<EOL><INDENT>rate_part = pd.read_csv(os.path.join(movie_path, part), index_col = '<STR_LIT:index>', header=None, sep='<STR_LIT:\t>', names=['<STR_LIT:user>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT:index>'], encoding=encoding)<EOL>rate_part['<STR_LIT>'] = part<EOL>ratings.append(rate_part)<EOL><DEDENT>Y = pd.concat(ratings)<EOL>return data_details_return({'<STR_LIT:Y>':Y, '<STR_LIT>':items, '<STR_LIT>':users, '<STR_LIT:info>': '<STR_LIT>'}, data_set)<EOL>
Data set of movie ratings collected by the University of Minnesota and 'cleaned up' for use.