@@ -2722,28 +2722,43 @@ def _take(self, indices, axis=0, convert=True, is_copy=True):
2722
2722
----------
2723
2723
indices : array-like
2724
2724
An array of ints indicating which positions to take.
2725
- axis : int , default 0
2726
- The axis on which to select elements. "0" means that we are
2727
- selecting rows, "1" means that we are selecting columns, etc .
2725
+ axis : {0 or 'index', 1 or 'columns', None} , default 0
2726
+ The axis on which to select elements. ``0`` means that we are
2727
+ selecting rows, ``1`` means that we are selecting columns.
2728
2728
convert : bool, default True
2729
- .. deprecated:: 0.21.0
2730
- In the future, negative indices will always be converted.
2731
-
2732
2729
Whether to convert negative indices into positive ones.
2733
2730
For example, ``-1`` would map to the ``len(axis) - 1``.
2734
2731
The conversions are similar to the behavior of indexing a
2735
2732
regular Python list.
2733
+
2734
+ .. deprecated:: 0.21.0
2735
+ In the future, negative indices will always be converted.
2736
+
2736
2737
is_copy : bool, default True
2737
2738
Whether to return a copy of the original object or not.
2739
+ **kwargs
2740
+ For compatibility with :meth:`numpy.take`. Has no effect on the
2741
+ output.
2742
+
2743
+ Returns
2744
+ -------
2745
+ taken : type of caller
2746
+ An array-like containing the elements taken from the object.
2747
+
2748
+ See Also
2749
+ --------
2750
+ DataFrame.loc : Select a subset of a DataFrame by labels.
2751
+ DataFrame.iloc : Select a subset of a DataFrame by positions.
2752
+ numpy.take : Take elements from an array along an axis.
2738
2753
2739
2754
Examples
2740
2755
--------
2741
2756
>>> df = pd.DataFrame([('falcon', 'bird', 389.0),
2742
- ('parrot', 'bird', 24.0),
2743
- ('lion', 'mammal', 80.5),
2744
- ('monkey', 'mammal', np.nan)],
2745
- columns=( 'name', 'class', 'max_speed') ,
2746
- index=[0, 2, 3, 1])
2757
+ ... ('parrot', 'bird', 24.0),
2758
+ ... ('lion', 'mammal', 80.5),
2759
+ ... ('monkey', 'mammal', np.nan)],
2760
+ ... columns=[ 'name', 'class', 'max_speed'] ,
2761
+ ... index=[0, 2, 3, 1])
2747
2762
>>> df
2748
2763
name class max_speed
2749
2764
0 falcon bird 389.0
@@ -2758,6 +2773,7 @@ def _take(self, indices, axis=0, convert=True, is_copy=True):
2758
2773
and 3rd rows, not rows whose indices equal 0 and 3.
2759
2774
2760
2775
>>> df.take([0, 3])
2776
+ name class max_speed
2761
2777
0 falcon bird 389.0
2762
2778
1 monkey mammal NaN
2763
2779
@@ -2777,16 +2793,6 @@ class max_speed
2777
2793
name class max_speed
2778
2794
1 monkey mammal NaN
2779
2795
3 lion mammal 80.5
2780
-
2781
- Returns
2782
- -------
2783
- taken : type of caller
2784
- An array-like containing the elements taken from the object.
2785
-
2786
- See Also
2787
- --------
2788
- numpy.ndarray.take
2789
- numpy.take
2790
2796
"""
2791
2797
2792
2798
@Appender (_shared_docs ['take' ])
0 commit comments