Doc updates · TomAugspurger/pandas@9a6c7d4 (original) (raw)

`@@ -1464,18 +1464,17 @@ def take(arr, indices, allow_fill=False, fill_value=None):

`

1464

1464

` allow_fill : bool, default False

`

1465

1465

`` How to handle negative values in indices.

``

1466

1466

``

1467

``

`` -

``

``

1467

`` +

``

1468

1468

`` from the right (the default). This is similar to :func:numpy.take.

``

1469

1469

``

1470

1470

`` * True: negative values in indices indicate

``

1471

1471

`` missing values. These values are set to fill_value. Any other

``

1472

1472

``` other negative values raise a ValueError.


`1473`

`1473`

``

`1474`

`1474`

` fill_value : any, optional

`

`1475`

``

`` -

Fill value to use for NA-indicies when `allow_fill` is True.

``

``

`1475`

`` +

Fill value to use for NA-indices when `allow_fill` is True.

``

`1476`

`1476`

```  This may be ``None``, in which case the default NA value for

1477

``

`` -

the type is used. For ndarrays, :attr:numpy.nan is used. For

``

1478

``

`-

ExtensionArrays, a different value may be used.

`

``

1477


 the type (``self.dtype.na_value``) is used.

1479

1478

``

1480

1479

` Returns

`

1481

1480

` -------

`

`@@ -1506,7 +1505,7 @@ def take(arr, indices, allow_fill=False, fill_value=None):

`

1506

1505

` >>> from pandas.api.extensions import take

`

1507

1506

``

1508

1507

``` With the default allow_fill=False, negative numbers indicate

```

1509

``

`-

positional indicies from the right.

`

``

1508

`+

positional indices from the right.

`

1510

1509

``

1511

1510

` >>> take(np.array([10, 20, 30]), [0, 0, -1])

`

1512

1511

` array([10, 10, 30])

`

`@@ -1525,8 +1524,7 @@ def take(arr, indices, allow_fill=False, fill_value=None):

`

1525

1524

`if not is_array_like(arr):

`

1526

1525

`arr = np.asarray(arr)

`

1527

1526

``

1528

``

`-

Do we require int64 or intp here?

`

1529

``

`-

indices = np.asarray(indices, dtype='int')

`

``

1527

`+

indices = np.asarray(indices, dtype=np.intp)

`

1530

1528

``

1531

1529

`if allow_fill:

`

1532

1530

`# Pandas style, -1 means NA

`

`@@ -1552,7 +1550,7 @@ def take_nd(arr, indexer, axis=0, out=None, fill_value=np.nan, mask_info=None,

`

1552

1550

` Input array.

`

1553

1551

` indexer : ndarray

`

1554

1552

` 1-D array of indices to take, subarrays corresponding to -1 value

`

1555

``

`-

indicies are filed with fill_value

`

``

1553

`+

indices are filed with fill_value

`

1556

1554

` axis : int, default 0

`

1557

1555

` Axis to take from

`

1558

1556

` out : ndarray or None, default None

`