Hi I have a dataframe consisting of 7989 rows × 1 columns. The different rows are consequences from different maritime piracy attack.
I then want to assign a value to the different rows depending on whether or not a specific word is included in one of the different list below. The value assigned will then depend on the different list.
The 6 lists:
five =['kill','execute','dead']
four =['kidnap','hostag','taken','abduct']
three =['injur','wound','assault']
two =['captur','hijack']
one =['stolen','damage','threaten','robber','destroy']
zero =['alarm','no','none']
I Have tried to do it like this:
df['five']=df.apply(lambda x: '5' if x == 'five' else '-')
and df is my dataframe
Can anyone help?