From dee9988cd8e8285fbf67429c24a924bd11c1d3b6 Mon Sep 17 00:00:00 2001 From: ThijsVroegh Date: Wed, 14 Aug 2024 16:37:02 +0200 Subject: [PATCH 1/2] solves #issue82 by fixing the comparison between a Series and a list --- orangecontrib/storynavigation/modules/actionanalysis.py | 3 ++- orangecontrib/storynavigation/modules/actoranalysis.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/orangecontrib/storynavigation/modules/actionanalysis.py b/orangecontrib/storynavigation/modules/actionanalysis.py index 4df7daf..2b230bb 100644 --- a/orangecontrib/storynavigation/modules/actionanalysis.py +++ b/orangecontrib/storynavigation/modules/actionanalysis.py @@ -222,7 +222,8 @@ def __filter_custom_word_matches(self, story_elements_df, selected_stories, cust current_frame.rename(columns={cust_tag_col: 'category'}, inplace=True) combined_df = pd.concat([combined_df, current_frame], axis=0) - combined_df = combined_df[combined_df['category'] not in ['?', 'nan']] + #combined_df = combined_df[combined_df['category'] not in ['?', 'nan']] + combined_df = combined_df[~combined_df['category'].isin(['?', 'nan'])] return combined_df.reset_index(drop=True) def calculate_customfreq_table(self, df, selected_stories=None): diff --git a/orangecontrib/storynavigation/modules/actoranalysis.py b/orangecontrib/storynavigation/modules/actoranalysis.py index c5e51a3..c903992 100644 --- a/orangecontrib/storynavigation/modules/actoranalysis.py +++ b/orangecontrib/storynavigation/modules/actoranalysis.py @@ -47,7 +47,9 @@ def __filter_custom_word_matches(self, story_elements_df, selected_stories, cust current_frame.rename(columns={cust_tag_col: 'category'}, inplace=True) combined_df = pd.concat([combined_df, current_frame], axis=0) - combined_df = combined_df[combined_df['category'] not in ['?', 'nan']] + #combined_df = combined_df[combined_df['category'] not in ['?', 'nan']] + combined_df = combined_df[~combined_df['category'].isin(['?', 'nan'])] + return combined_df.reset_index(drop=True) def __filter_rows(self, story_elements_df, pos_tags): From 61d5458ef9be9d925aa9fcc7ac5614d54b7bfcf2 Mon Sep 17 00:00:00 2001 From: ThijsVroegh Date: Tue, 3 Sep 2024 14:55:48 +0200 Subject: [PATCH 2/2] Remove old commented-out lines of code --- orangecontrib/storynavigation/modules/actionanalysis.py | 3 +-- orangecontrib/storynavigation/modules/actoranalysis.py | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/orangecontrib/storynavigation/modules/actionanalysis.py b/orangecontrib/storynavigation/modules/actionanalysis.py index 2b230bb..9807ef4 100644 --- a/orangecontrib/storynavigation/modules/actionanalysis.py +++ b/orangecontrib/storynavigation/modules/actionanalysis.py @@ -221,8 +221,7 @@ def __filter_custom_word_matches(self, story_elements_df, selected_stories, cust current_frame['classification'] = c_col current_frame.rename(columns={cust_tag_col: 'category'}, inplace=True) combined_df = pd.concat([combined_df, current_frame], axis=0) - - #combined_df = combined_df[combined_df['category'] not in ['?', 'nan']] + combined_df = combined_df[~combined_df['category'].isin(['?', 'nan'])] return combined_df.reset_index(drop=True) diff --git a/orangecontrib/storynavigation/modules/actoranalysis.py b/orangecontrib/storynavigation/modules/actoranalysis.py index c903992..e58e0c0 100644 --- a/orangecontrib/storynavigation/modules/actoranalysis.py +++ b/orangecontrib/storynavigation/modules/actoranalysis.py @@ -46,8 +46,7 @@ def __filter_custom_word_matches(self, story_elements_df, selected_stories, cust current_frame['classification'] = c_col current_frame.rename(columns={cust_tag_col: 'category'}, inplace=True) combined_df = pd.concat([combined_df, current_frame], axis=0) - - #combined_df = combined_df[combined_df['category'] not in ['?', 'nan']] + combined_df = combined_df[~combined_df['category'].isin(['?', 'nan'])] return combined_df.reset_index(drop=True)