director and cast preprocessing
This commit is contained in:
@@ -1,22 +1,17 @@
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
from sentence_transformers import SentenceTransformer
|
from sentence_transformers import SentenceTransformer
|
||||||
from preprocessing import clean_plot, get_genre
|
from preprocessing import clean_plot, get_genre, pre_director, clean_cast
|
||||||
from sklearn.metrics.pairwise import cosine_similarity
|
from sklearn.metrics.pairwise import cosine_similarity
|
||||||
|
|
||||||
df = pd.read_excel('C:\\Users\\ishaa\\OneDrive\\Documents\\MSU\\Spring 2026\\Data mining\\Project\\updated_data.xlsx', engine='openpyxl')
|
df = pd.read_excel('C:\\Users\\ishaa\\OneDrive\\Documents\\MSU\\Spring 2026\\Data mining\\Project\\updated_data.xlsx', engine='openpyxl')
|
||||||
|
|
||||||
print(len(df))
|
|
||||||
|
|
||||||
df = df.dropna(subset=['Genre', 'Plot'])
|
df = df.dropna(subset=['Genre', 'Plot'])
|
||||||
|
|
||||||
print(len(df))
|
|
||||||
|
|
||||||
# df = df[:2]
|
|
||||||
|
|
||||||
df['Processed_Plot'] = df['Plot'].apply(clean_plot)
|
df['Processed_Plot'] = df['Plot'].apply(clean_plot)
|
||||||
|
|
||||||
df['Genre'] = df[['Genre', 'Title']].apply(get_genre, axis=1)
|
df['Pre_genre'] = df[['Genre', 'Title']].apply(get_genre, axis=1)
|
||||||
|
|
||||||
|
df['Pre_director'] = df['Director'].apply(pre_director)
|
||||||
|
df['Pre_cast'] = df['Cast'].apply(clean_cast)
|
||||||
|
|
||||||
df.to_excel('C:\\Users\\ishaa\\OneDrive\\Documents\\MSU\\Spring 2026\\Data mining\\Project\\preprocessed_data.xlsx', index=False)
|
df.to_excel('C:\\Users\\ishaa\\OneDrive\\Documents\\MSU\\Spring 2026\\Data mining\\Project\\preprocessed_data.xlsx', index=False)
|
||||||
|
|
||||||
print(df.columns)
|
|
||||||
Reference in New Issue
Block a user