I have a numpy array in this form:
array([['A', 2.2, 9.1],
['A', 7.1, 2.3],
['B', 4.1, 1.1]],dtype=object)
So I would like to query 'A' and then return all rows and columns with (matching) the string 'A'. Anything not matching the condition is ignored. So the output should be:
form = array([['A', 2.2, 9.1],
['A', 7.1, 2.3],dtype=object)
I tried using j = form[np.where(form == 'A')]
which gives array(['A', 'A'], dtype=object). This is not what I want.
Could someone please let me know how I can do this?
dtypesin a numpy array is NOT a good idea! A good tool to do things like this would bepandas.