<jupyter_start><jupyter_text>Reading Data Files<jupyter_code>import pandas as pd
path = 'ml-1m/'
names = ['movie_id', 'title', 'genre']
movies = pd.read_csv(path+'movies.dat', sep='::',
                    header=None, names=names, engine='python')
movies.head()
user_names = ['user_id', 'gender', 'age', 'occupation', 'zip']

rating_names = ['user_id', 'movie_id', 'rating', 'timestamp']
ratings = pd.read_csv(path+'ratings.dat', sep='::',
                     header=None, names = rating_names, engine='python')
len(ratings[ratings['user_id'] == 1])
ratings.groupby('user_id').size().sort_values(ascending=False).head(10)
data = pd.merge(pd.merge(users, ratings), movies)
data.head()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1972027972027972, 'fraction_numerical': 0.005594405594405594, 'mean_word_length': 5.509090909090909, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '421789', 'license': 'MIT', 'n_tokens_mistral': 262, 'n_tokens_neox': 255, 'n_words': 45, 'path': 'Section 2/2.3-reading_external data.ipynb', 'repo_name': 'PacktPublishing/The-Modern-Python-Challenge-v-', 'size': '715'}