text_html_output_1.png
import glob

import numpy as np # linear algebra

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import glob
rating_files = glob.glob('/kaggle/input/netflix-prize-data/combined_data_*.txt')
rating_files

df_ratings = pd.concat([pd.read_csv(filename, header=None, names=['customer_id', 'rating', 'date'], parse_dates=['date']) for filename in rating_files])

df_ratings['movie_id'] = np.where(df_ratings['rating'].isna(), df_ratings['customer_id'], np.nan)
df_ratings['movie_id'] = df_ratings['movie_id'].str.split(':').str[0]
df_ratings['movie_id'] = df_ratings['movie_id'].fillna(method='ffill')
df_ratings.dropna(subset=['rating', 'date'], inplace=True)

df_ratings = df_ratings.astype({'customer_id': 'int', 'movie_id': 'int'})

df_ratings.isna().sum()