[ ][ ]]array([[ ][ ]]as you can seeit has sliced along axis the first axis slicethereforeselects range of elements along an axis you can pass multiple slices just like you can pass multiple indexesin [ ]arr [: :out[ ]array([[ ][ ]]when slicing like thisyou always obtain array views of the same number of dimensions by mixing integer indexes and slicesyou get lower dimensional slicesin [ ]arr [ : out[ ]array([ ]in [ ]arr [ : out[ ]array([ ]see figure - for an illustration note that colon by itself means to take the entire axisso you can slice only higher dimensional axes by doingin [ ]arr [:: out[ ]array([[ ][ ][ ]]of courseassigning to slice expression assigns to the whole selectionin [ ]arr [: : boolean indexing let' consider an example where we have some data in an array and an array of names with duplicates ' going to use here the randn function in numpy random to generate some random normally distributed datain [ ]names np array(['bob''joe''will''bob''will''joe''joe']in [ ]data randn( in [ ]names out[ ]array(['bob''joe''will''bob''will''joe''joe']dtype='| 'in [ ]data out[ ]array([[- - ][- - ][- - ] - ][- - ]the numpy ndarraya multidimensional array object www it-ebooks info