<jupyter_start><jupyter_text>Import functions<jupyter_code>import pandas as pd
import numpy as np
from google.colab import drive
drive.mount('/content/drive')<jupyter_output>Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount("/content/drive", force_remount=True).<jupyter_text>Filter all data on startYear >= 2010 & titleType = Movies  Load Title_basicsDataFrame with the information of the movies<jupyter_code>#Load dataset
title_basics = pd.read_csv('/content/drive/MyDrive/My project/Dataset TSV/title.basics.tsv', sep='\t', index_col = 'tconst', low_memory=False)
title_basics
title_basics.isna().sum()
title_basics= title_basics.dropna()
title_basics.isna().sum()
title_basics.startYear.value_counts()
title_basics = title_basics[title_basics['startYear'] != r'\N']
title_basics = title_basics[title_basics['genres'] != r'\N']
title_basics.startYear.value_counts()
title_basics['startYear'] = title_basics['startYear'].astype(int)
title_basics.dtypes
title_basics = title_basics\
                .loc[(title_basics['startYear'] >= 2010) & (title_basics['titleType'] == 'movie')]\
                .sort_values(by=['startYear'])
    
title_basics<jupyter_output><empty_output><jupyter_text>Load title_ratings Merge rating DataFrame with the movies DataFrame<jupyter_code>title_ratings = pd.read_csv('/content/drive/MyDrive/My project/Dataset TSV/title.ratings.tsv', sep='\t', index_col = 'tconst')
title_ratings
title_basics = pd.merge(title_basics,title_ratings, on = 'tconst', how='inner')
title_basics
del title_ratings<jupyter_output><empty_output><jupyter_text>Load title_crew Filter the DataFrame with the movies crew(directors and writers) on the movies that are in the movies DataFrame<jupyter_code>title_crew = pd.read_csv('/content/drive/MyDrive/My project/Dataset TSV/title.crew.tsv', sep='\t', index_col = 'tconst')
title_crew
title_crew = title_crew.loc[title_crew.index.isin(title_basics.index)]
title_crew<jupyter_output><empty_output><jupyter_text>Load title_principals Filter the DataFrame with the movies principals(actors, actress, director, writer and producer) on the movies that are in the movies DataFrame<jupyter_code>title_principals = pd.read_csv('/content/drive/MyDrive/My project/Dataset TSV/title.principals.tsv', sep='\t')
title_principals
title_principals = title_principals.loc[title_principals['tconst'].isin(title_basics.index)]
title_principals = title_principals[title_principals['category'].isin(['actor','actress'])]
title_principals = pd.merge(title_principals,title_basics[['startYear','averageRating']], on = 'tconst')
title_principals<jupyter_output><empty_output><jupyter_text>Load name_basics Filter the DataFrame with the crew names on the DataFrame with movies<jupyter_code>name_basics = pd.read_csv('/content/drive/MyDrive/My project/Dataset TSV/name.basics.tsv',sep='\t', index_col = 'nconst')
name_basics
name_basics = name_basics.loc[name_basics.index.isin(title_principals['nconst'])]
name_basics<jupyter_output><empty_output><jupyter_text>Create dummy variables for genres on the title_basics dataframe<jupyter_code>title_basics = pd.merge(title_basics.drop('genres', axis = 1),title_basics['genres'].str.get_dummies(sep = ','), on = 'tconst')
title_basics.head()<jupyter_output><empty_output><jupyter_text>Export Filtered dataframes to csv<jupyter_code>title_basics.to_csv('movies_info.csv')
title_crew.to_csv('movies_crew.csv')
title_principals.to_csv('movies_actors.csv', index=False)
name_basics.to_csv('crew_names.csv')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12485907553551297, 'fraction_numerical': 0.002536640360766629, 'mean_word_length': 8.31496062992126, 'pattern_counts': {'":': 0, '<': 32, '<?xml version=': 0, '>': 34, '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': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '632365', 'license': 'MIT', 'n_tokens_mistral': 1272, 'n_tokens_neox': 1245, 'n_words': 206, 'path': 'Dataset Filtering S0.ipynb', 'repo_name': 'Ramakrishnanrocx/Movie-Recommendation', 'size': '3548'}