How can I check for NaN values?

后端 未结 17 2123
盖世英雄少女心
盖世英雄少女心 2020-11-22 05:02

float(\'nan\') results in Nan (not a number). But how do I check for it? Should be very easy, but I cannot find it.

17条回答
  •  温柔的废话
    2020-11-22 06:01

    for strings in panda take pd.isnull:

    if not pd.isnull(atext):
      for word in nltk.word_tokenize(atext):
    

    the function as feature extraction for NLTK

    def act_features(atext):
    features = {}
    if not pd.isnull(atext):
      for word in nltk.word_tokenize(atext):
        if word not in default_stopwords:
          features['cont({})'.format(word.lower())]=True
    return features
    

提交回复
热议问题