names == 'Bob' returns a boolean array [True, False, False, True, False,
False, False], and data[boolean_array] returns all those elements of data
where the boolean array is True. data is a list of 7 lists, so the two
lists corresponding to True values are returned.
Read the Numpy basics and Advan
Hi,
I am new to NumPy, Can someone help me in understanding below code.
>>> names = np.array(['Bob', 'Joe', 'Will', 'Bob', 'Will', 'Joe', 'Joe'])
>>> data = np.random.random((7,4))
>>> print data
[[ 0.85402649 0.12827655 0.580 0.86288236]
[ 0.30162683 0.45269508 0.98098039 0.1291469