You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Not working in full pandaspd.DataFrame(np.full((5,5), True)) &np.full((1,5), False)
#ValueError: Unable to coerce to DataFrame, shape must be (5, 5): given (1, 5)# After extracting the numpy array it works as expected:pd.DataFrame(np.full((5,5), True)).values&np.full((1,5), False)
Problem description
I have a dataframe with shape (m,n), each column filled with bools.
Now I have a numpy (column) vector of length n filled with bools and I would like to apply the logical AND (&) such that the operation is broadcast from the vector onto each column.
This works only when using df.values, not when applying & on the dataframe.
The same holds for other operations such as *, /
I am not sure whether this is intended behaviour - I could not find the matching documentation.
The text was updated successfully, but these errors were encountered:
Code Sample, a copy-pastable example if possible
Problem description
I have a dataframe with shape (m,n), each column filled with bools.
Now I have a numpy (column) vector of length n filled with bools and I would like to apply the logical AND (&) such that the operation is broadcast from the vector onto each column.
This works only when using df.values, not when applying & on the dataframe.
The same holds for other operations such as *, /
I am not sure whether this is intended behaviour - I could not find the matching documentation.
The text was updated successfully, but these errors were encountered: