Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/291.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/pandals仅从str.findall返回不同的值_Python_Pandas - Fatal编程技术网

使用python/pandals仅从str.findall返回不同的值

使用python/pandals仅从str.findall返回不同的值,python,pandas,Python,Pandas,是否可以使用str.findall在Python中仅返回唯一的结果来限制空结果,例如: df['A'].str.findall('Dog') returns 2 [Dog] 3 [] 4 [] 5 [] 6 [Dogs] 7 [] looking for [Dog] [Dogs] []

是否可以使用str.findall在Python中仅返回唯一的结果来限制空结果,例如:

df['A'].str.findall('Dog')

returns
    2           [Dog]
    3             []
    4             []
    5             []
    6           [Dogs]
    7             []

looking for 
    [Dog]
    [Dogs]
    []

.unique()
添加到末尾?您好。这样做会返回TypeError:unhabable type:“list”,如果您使用的是
.str