From d4a8245390d6ecab7857a3d1a315857d4a12b824 Mon Sep 17 00:00:00 2001 From: Yevhenii Poliakov Date: Sun, 14 May 2023 18:05:40 +0200 Subject: [PATCH] update script4 --- script4.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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'])