I have some problems with writing the right code to obtain the result that I want. I have a df composed as follows:
df= ['Date','Error_Id','State','Alarm','Group','Production_type','Error_frequency']
There are 4 types of errors in the df (e.g. 1,2,3,4).
I would like to add a column of booleans for each error, with a 1 if the error is present in the row and a 0 if not.
I have tried to do this with the if condition, the isin() method and the bool() method but as of now I obtained only errors. Hereafter the code I tried to use for the isin() and bool() methods
test = alarms[alarms.Error_Id.isin([1])].bool()
I also thought of creating a new df with this and the use it to for comparison with the original df but I think that this is not the right way to do it.
Concerning the Error message with the isin() and bool() methods it is the following:
ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().