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

Check isnan function for empty strings #71

Open
ajdapretnar opened this issue Mar 9, 2016 · 2 comments
Open

Check isnan function for empty strings #71

ajdapretnar opened this issue Mar 9, 2016 · 2 comments

Comments

@ajdapretnar
Copy link
Contributor

Bioinformatics Add-on often uses isnan to check for unknowns even in places, where one would expect string values. isnan fails for strings. Check whether these functions work and how. Fix the issue for empty strings accordingly.

Widgets that use isnan:

  • OWFeatureSelection
  • OWGeneInfo
  • OWEnrichmentAnalysis
  • OWKEGG
  • OWSelectGenes
@cheral
Copy link

cheral commented Mar 9, 2016

if the string contains a newline character, then it is not empty. Same goes for tabs, spaces and all forms of non-printable characters. We need to first strip the string and then check if the stripped string is empty.

isnan fails maybe because it uses number implementation , I think ...

how about using this function below ?

def isNotBlank (myString):
    if myString and myString.strip():
    #myString is not None AND myString is not empty or blank
        return True
    #myString is None OR myString is empty or blank
    return False

@kernc
Copy link
Contributor

kernc commented Mar 10, 2016

@cheral Strings are stripped in data loading stage. If the string is empty/not provided/strips to nothing, then it is represented as '' (an empty string). However, numpy.isnan() chokes on ''.

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

No branches or pull requests

3 participants