pythonpython-3.xpython-2.7graphlab

graphlab create dropna does not work


I'm testing graphlabe create with following

sf=gl.SFrame(['t1','t2','','t3','','t4'])
sf.dropna()

accoding to graphlab api

the above should remove empty values(na), but actually it does not, and no errors given either. anyone knows why?


Solution

  • Your '' is either None nor NaN:

    import math
    
    print(None == '')
    print(float('nan')=='')
    print(math.isnan(float('nan')))
    

    Output:

    False
    False
    True
    

    Doku: dropna()

    Remove missing values from an SFrame. A missing value is either None or NaN.

    Your value '' is neither so it stays.