I know the following logical operation works with numpy:
A = np.array([True, False, True])
B = np.array([1.0, 2.0, 3.0])
C = A*B = array([1.0, 0.0, 3.0])
But the same isn't true if B is an array of strings. Is it possible to do the following:
A = np.array([True, False, True])
B = np.array(['eggs', 'milk', 'cheese'])
C = A*B = array(['eggs', '', 'cheese'])
That is a string multiplied with False should equal an empty string. Can this be done without a loop in Python (doesn't have to use numpy)?
Thanks!