w3resource

Pandas Series: take() function

Series-take() function

The take() function is used to return the elements in the given positional indices along an axis.

This means that we are not indexing according to actual values in the index attribute of the object. We are indexing according to the actual position of the element in the object.

Syntax:

Series.take(self, indices, axis=0, is_copy=False, **kwargs)
Pandas Series take image
Name Description Type/Default Value Required / Optional
indices An array of ints indicating which positions to take. array-like Required
axis The axis on which to select elements. 0 means that we are selecting rows, 1 means that we are selecting columns. {0 or ‘index’, 1 or ‘columns’, None}
Default Value: 0
Required
is_copy Whether to return a copy of the original object or not. bool
Default Value: True
Required
**kwargs For compatibility with numpy.take(). Has no effect on the output Required

Returns: taken - same type as caller An array-like containing the elements taken from the object.

Example:


Download the above Notebook from here.



Inviting useful, relevant, well-written and unique guest posts