I have an items array which has shape (n, 3), and a counts array which has the same shape (n, 3). How can I make every C in items to have count = 0 without resorting to loops?
items = np.array([['B', 'A', 'C'],
['B', 'B', 'C'],
['A', 'B', 'A'],
['C', 'C', 'C'],
['B', 'B', 'B']])
counts = np.array([[1, 3, 2],
[4, 2, 3],
[2, 2, 1],
[3, 2, 1],
[1, 2, 1]])
Expected output:
>>> counts
np.array([[1, 3, 0],
[4, 2, 0],
[2, 2, 1],
[0, 0, 0],
[1, 2, 1]])