I try to separate words form DataFrame Columns:
Binary = []
for i in range(0,len(data)):
if data['attack'][i] == 'normal':
Binary.append(1)
else:
Binary.append(0)
print(len(Binary))
data= pd.DataFrame({'attack':['normal','neptune','ps','normal','neptune']})
print(data)
attack
0 normal
1 neptune
2 ps
3 normal
4 neptune
we want to change these column value into: ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
attack
0 1
1 0
2 0
3 1
4 0
only normal = 1
else 0