Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solves #issue82 by fixing the comparison between a Series and a list #83

Merged
merged 2 commits into from
Sep 3, 2024

Conversation

ThijsVroegh
Copy link
Collaborator

Issue

Fixes #issue82.

A previous bugfix around >>combined_df = combined_df[combined_df['category'] not in ['?', 'nan']] << was wrong in the sense that it was trying to check if the entire combined_df['category'] Series is "not in" the list ['?', 'nan']. This boils down to a comparison between a Series and a list, which led to a ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

Description of changes

To properly filter the DataFrame by checking if each element in the category column is not in the list ['?', 'nan'], now the .isin() method is used in combination with the negation operator '~'

Includes
  • Code changes
  • Tests
  • Documentation

Copy link
Member

@eriktks eriktks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested the issue:

  • on the branches "master" and this branch,
  • using the workflow displayed below
  • with dutch_haliday_action_list.csv as input for the File widget
  • letters.tab as input for the widget Corpus

Result: the issue occurred with the master branch but not with the current branch which shows that the issue was present but is now solved

Tip: the changed code is reasonable but I would remove the commented lines of code before merging

Screenshot from 2024-09-03 14-11-55

@ThijsVroegh
Copy link
Collaborator Author

@eriktks Thanks; I removed the old, commented-out lines of code.

@ThijsVroegh ThijsVroegh merged commit 0b05b9c into master Sep 3, 2024
0 of 3 checks passed
@ThijsVroegh ThijsVroegh deleted the issue82 branch September 3, 2024 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants