update script4

This commit is contained in:
Yevhenii Poliakov 2023-05-14 18:05:40 +02:00
parent 75381edb56
commit d4a8245390

View File

@ -22,7 +22,7 @@ try:
except pd.errors.ParserError as e:
print(f"Error occurred while parsing the dataset: {e}")
print("Dropping rows with inconsistent number of columns...")
data = data[data.apply(lambda x: len(x) == 12 if isinstance(x, list) else True, axis=1)]
data = data[~data.apply(lambda x: len(x) != 12, axis=1)]
# Convert categorical variables to numerical representations
data = pd.get_dummies(data, columns=['Genres', 'Director Name', 'Writer Name'])