I have a list of data frames in Python (3) with boolean values and I want the row-wise AND of the list, but I have no idea how to do it:
d1 = pd.DataFrame({'v' : [True, True, True, True]})
d2 = pd.DataFrame({'v' : [False, True, True, True]})
d3 = pd.DataFrame({'v' : [False, True, False, True]})
dfs = [d1, d2, d3]
What I'd like to have is a data frame with the values [False, True, False, True]. I've tried using a lambda with apply
but I have no idea if that's possible with a list of values of which I do not know the size. And I did not see a foldLeft
(or similar option) to apply a binary operator on a list of values or DataFrame columns.
Any ideas?