I'm trying to generate a new columns using following code
list = ['LHR','-1','-3','LGW','MAD','SIN','KUL','JFK','HKG','PVG','IST','SDA','GLA']
for i in list:
if plotdata.loc[plotdata['LOCATION'] == i] :
plotdata['city'] = plotdata['LOCATION']
else:
plotdata['city'] = 'others'
I get the following error:
ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
The datatype is category, why do I get this error, please?