3
Hello,
I have the following dataframe:
import pandas as pd
import numpy as np
x = pd.DataFrame({'A': [1,2,3,0],
'B': [5,0,0,1]})
What I want is to create a column’D', which is True if the two columns 'A' and 'B' are > 0
What I’ve already tried:
x['D'] = x.A > 0 or x.B > 0
Valueerror: The Truth value of a Series is ambiguous. Use a.Empty, a.bool(), a.item(), a.any() or a.all().
I also tried to:
x['D'] = np.where((x.A >0) or (x.B > 0), True, False)
Does anyone know how I can do it?