diff --git a/script4.py b/script4.py index e6b3224..59eb7dc 100644 --- a/script4.py +++ b/script4.py @@ -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'])