Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/318.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 类型为'的参数;非类型';熊猫不好吃吗_Python_Pandas - Fatal编程技术网

Python 类型为'的参数;非类型';熊猫不好吃吗

Python 类型为'的参数;非类型';熊猫不好吃吗,python,pandas,Python,Pandas,我有以下两个功能: #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_descript

我有以下两个功能:

#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)
以下是我的数据格式:

简短描述,标签1

这些是我在2017年ACE_数据中的列。 我需要检查简短描述中的关键字并更新label1

下面是我的更新命令:

#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”的参数不可iterable


我在这里遗漏了什么,我如何修复它。

您很清楚这个问题。“类型为'NoneType'的参数不可编辑”。在python中,若您试图迭代一个非类型的对象,那个么问题就会出现


在您的情况下,除了“short description”列值之外,函数的所有其他参数都是固定的。它随着每次迭代而变化。检查“简短描述”列是否包含任何“NaN”值

我写了一个答案,但这也有助于了解您试图用数据更新我的问题及其目的