<jupyter_start><jupyter_text>extracting movies of 2019<jupyter_code>link = "https://en.wikipedia.org/wiki/List_of_American_films_of_2019"
df1 = pd.read_html(link, header=0)[2]
df2 = pd.read_html(link, header=0)[3]
df3 = pd.read_html(link, header=0)[4]
df4 = pd.read_html(link, header=0)[5]
df = df1.append(df2.append(df3.append(df4,ignore_index=True),ignore_index=True),ignore_index=True)
df
# getting genres by using tmdb api
df['genres'] = df['Title'].map(lambda x: get_genre(str(x)))
df['genres']
df_2019 = df[['Title','Cast and crew','genres']]
df_2019
df_2019['Cast and crew'][1]
df_2019['director_name']=df_2019['Cast and crew'].map(lambda x : get_director(x))
df_2019['actor_1_name'] = df_2019['Cast and crew'].map(lambda x: get_actor1(x))
df_2019['actor_2_name'] = df_2019['Cast and crew'].map(lambda x: get_actor2(x))
df_2019['actor_3_name'] = df_2019['Cast and crew'].map(lambda x: get_actor3(x))
df_2019
## applying all the changes

df_2019 = df_2019.rename(columns={'Title':'movie_title'})

new_df19 = df_2019.loc[:,['director_name','actor_1_name','actor_2_name','actor_3_name','genres','movie_title']]

new_df19['actor_2_name'] = new_df19['actor_2_name'].replace(np.nan, 'unknown')
new_df19['actor_3_name'] = new_df19['actor_3_name'].replace(np.nan, 'unknown')

new_df19['movie_title'] = new_df19['movie_title'].str.lower()

new_df19['comb'] = new_df19['actor_1_name'] + ' ' + new_df19['actor_2_name'] + ' '+ new_df19['actor_3_name'] + ' '+ new_df19['director_name'] +' ' + new_df19['genres']
new_df19
new_df = new_df18.append(new_df19,ignore_index=True)
new_df
old_df=pd.read_csv('new_datax.csv')
old_df
final_df=old_df.append(new_df,ignore_index=True)
final_df
final_df.isnull().sum()
final_df = final_df.dropna()
final_df.to_csv('final_data',index=False)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18333333333333332, 'fraction_numerical': 0.07388888888888889, 'mean_word_length': 9.532163742690058, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, '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': '443293', 'license': 'Apache-2.0', 'n_tokens_mistral': 818, 'n_tokens_neox': 739, 'n_words': 97, 'path': '.ipynb_checkpoints/preprocessing 3-checkpoint.ipynb', 'repo_name': 'niket-kumar9907/movie-recommendation-model', 'size': '1800'}