我试图在遍历df.series并检查字符串是否包含的同时创建新的df列。
some_list = ['Nashville', 'Oak Ridge']
data.COLUMN
...
'Nashville is a great city'
'Oak Ridge has a research center'
for city in some_list:
for row in data.COLUMN:
if city in row:
data['CITY'] = city
基本上,如果迭代中包含城市,我想从列表中创建一个城市列