python 比较列表内字符串是否相等?

for index, row in jmd_tiqu.iterrows():
for index_,row_ in point.iterrows():
if row_['NAME'].str.contains(str.jmd_tiqu.iloc[index]['jmd_name']):
jmd_tiqu[index, 'ROAD_DIST'] = row_['ROAD_DIST']
jmd_tiqu[index, 'RAIL_DIST'] = row_['RAIL_DIST']
jmd_tiqu[index, 'RIVER_DIST'] = row_['RIVER_DIST']
jmd_tiqu[index, 'LAKE_DISTT'] = row_['LAKE_DISTT']
为什么报错'str' object has no attribute 'str'?
jmd_tiqu 存储.shp数据
point 存储excel 数据

第1个回答  2021-04-29
要使用contains方法,直接在后面跟就可以了,加个str当然会报错
---不好意思,看了一下,python应该没有contains这个方法
可以使用find()代替
注意不要写成s.str.find(),s.find()就行了
第2个回答  2021-03-17
用的是哪个库?str这种方法多见于pandas里
相似回答