2017-07-13 29 views
-2

ではありません、私は2つの機能の下に持っている:以下引数は 'NoneType' 反復可能なパンダ

#To update the label1 if word is present with is_name 
def update(data,word_lists, is_name): 
for wlist in word_lists: 
    if check_keywords(data, wlist): 
     return is_name 
return '' 

#To check if Words are present in my Short_description field. 
def check_keywords(data, words): 
cnt=0 
for word in words: 
    if word in data: 
     cnt+=1 
return cnt==len(words) 

私のデータフォーマットである:

SHORT_DESCRIPTION、LABEL1

これらは、私のデータACE_2017にある列。 iは以下

は私のupdateコマンドでLABEL1 SHORT_DESCRIPTIONのキーワードと更新を確認する必要があります。

#To check if "access request" or "request Access" is present in Short_description then it should update label1 with 'Access request' 

ACE_2017.ix[ACE_2017['label1']=='','label1'] = ACE_2017[ACE_2017['label1']==''].Short_description.map(lambda x: update(x,[['access request','request Access']],'Access request')) 

が、私は上記のコマンドを実行したときには、タイプの

引数を言う 'NoneType'反復可能ではありません

どうすればこの問題を解決できますか?

+0

私は答えを書いたが、あなたも何をしようとしているかを知るのに役立つだろう – snapcrack

+0

はデータとその目的で私の質問を更新した – toofrellik

答えて

1

この問題はあなたには明らかです。 "型 'NoneType'の引数は反復可能ではありません"。 PythonではNone型のオブジェクトを反復しようとすると問題が発生します。

あなたのケースでは、「短い説明」列の値を除いて、他のすべてのパラメータが固定されています。これは繰り返しごとに変化しています。 「短い説明」列に「NaN」の値が含まれているかどうかを確認します。

関連する問題