Skip to content

DOC: Improve the docstring of Series.take #20179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 14, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 20 additions & 18 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2525,24 +2525,35 @@ def _take(self, indices, axis=0, convert=True, is_copy=True):
The axis on which to select elements. "0" means that we are
selecting rows, "1" means that we are selecting columns, etc.
convert : bool, default True
.. deprecated:: 0.21.0
In the future, negative indices will always be converted.

Whether to convert negative indices into positive ones.
For example, ``-1`` would map to the ``len(axis) - 1``.
The conversions are similar to the behavior of indexing a
regular Python list.
.. deprecated:: 0.21.0
In the future, negative indices will always be converted.
is_copy : bool, default True
Whether to return a copy of the original object or not.
kwargs : xxx, default xxx
TODO MUST ADD A REASONABLE DESCRIPTION.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optional keyword arguments to ``:meth:pandas.compat.numpy.function.validate_take

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix in later commit


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

See Also
--------
numpy.ndarray.take : TODO
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return an array formed from the elements at given indices

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix in later commit

numpy.take : TODO
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take elements from an array along an axis

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix in later commit


Examples
--------
>>> df = pd.DataFrame([('falcon', 'bird', 389.0),
('parrot', 'bird', 24.0),
('lion', 'mammal', 80.5),
('monkey', 'mammal', np.nan)],
columns=('name', 'class', 'max_speed'),
index=[0, 2, 3, 1])
... ('parrot', 'bird', 24.0),
... ('lion', 'mammal', 80.5),
... ('monkey', 'mammal', np.nan)],
... columns=('name', 'class', 'max_speed'),
... index=[0, 2, 3, 1])
>>> df
name class max_speed
0 falcon bird 389.0
Expand All @@ -2557,6 +2568,7 @@ def _take(self, indices, axis=0, convert=True, is_copy=True):
and 3rd rows, not rows whose indices equal 0 and 3.

>>> df.take([0, 3])
name class max_speed
0 falcon bird 389.0
1 monkey mammal NaN

Expand All @@ -2576,16 +2588,6 @@ class max_speed
name class max_speed
1 monkey mammal NaN
3 lion mammal 80.5

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

See Also
--------
numpy.ndarray.take
numpy.take
"""

@Appender(_shared_docs['take'])
Expand Down