创建条件的新df列

时间:2019-04-18 01:16:39

标签: python-3.x pandas

我试图在遍历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

基本上,如果迭代中包含城市,我想从列表中创建一个城市列

0 个答案:

没有答案