I am just trying to categorize some data with pandas Basically my data is a string and I want to modify it depending on the value of the X first characters.
I tried this :
data['BO In Code'].loc[data['BO In Code'][:2]=='XU']=1
Unalignable boolean Series key provided
This :
data['BO In Code'].loc[str(data['BO In Code'])[:2]=='XU']=1
and this :
data['BO In Code'].loc[data['BO In Code'].index[:2]=='XU']=1
gave me :
'Cannot use a single bool to index into setitem'