Name

take

Synopsis

take(a,indices,axis=0)

Returns an array t with the same type code and rank as a, containing the subset of a’s elements that would be in a slice along axis comprising the given indices. For example, after t =take( a ,(1,3)), t .shape==(2,)+ a .shape[1:], and t’s elements are those in the second and fourth rows of a.

Get Python in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.