Skip to content

Commit 05dff6c

Browse files
committed
Improve slice docstrings
Update the `np.strings.slice` docstrings to follow convention and correctly split between argument type and documentation. Also update the `slice` release note to follow convention for new functions. Lastly, fix the gcc version upgrade PR reference from numpy#28101 to numpy#28102.
1 parent 2e700c6 commit 05dff6c

File tree

4 files changed

+23
-18
lines changed

4 files changed

+23
-18
lines changed
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
* New function `numpy.strings.slice`
2-
The new function `numpy.strings.slice` was added, which implements fast
3-
native slicing of string arrays. It supports the full slicing API including
4-
negative slice offsets and steps.
1+
New function `numpy.strings.slice`
2+
----------------------------------
3+
The new function `numpy.strings.slice` was added, which implements fast
4+
native slicing of string arrays. It supports the full slicing API including
5+
negative slice offsets and steps.

numpy/_core/code_generators/ufunc_docstrings.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5461,20 +5461,22 @@ def add_newdoc(place, name, doc):
54615461
Parameters
54625462
----------
54635463
a : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype
5464+
Input array
54645465
5465-
start : the start of the slice, an integer or an array of integers
5466-
which can be broadcasted to`a`'s shape
5466+
start : array-like, with integer dtype
5467+
The start of the slice, broadcasted to `a`'s shape
54675468
5468-
stop : the end point of the slice, an integer or an array of integers
5469-
which can be broadcasted to`a`'s shape
5469+
stop : array-like, with integer dtype
5470+
The end of the slice, broadcasted to `a`'s shape
54705471
5471-
step : the step for the slice, an integer or an array of integers
5472-
which can be broadcasted to`a`'s shape
5472+
step : array-like, with integer dtype
5473+
The step for the slice, broadcasted to `a`'s shape
54735474
54745475
Returns
54755476
-------
54765477
out : ndarray
5477-
Output array of str or unicode, depending on input type
5478+
Output array of ``StringDType``, ``bytes_`` or ``str_`` dtype,
5479+
depending on input type
54785480
54795481
Examples
54805482
--------

numpy/_core/strings.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,20 +1651,22 @@ def slice(a, start=None, stop=None, step=None, /):
16511651
Parameters
16521652
----------
16531653
a : array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtype
1654+
Input array
16541655
1655-
start : the start of the slice, can be None, an integer or
1656-
an array of integers which can be broadcasted to`a`'s shape
1656+
start : None, an integer or an array of integers
1657+
The start of the slice, broadcasted to `a`'s shape
16571658
1658-
stop : the end point of the slice, can be None, and integer or
1659-
an array of integers which can be broadcasted to`a`'s shape
1659+
stop : None, an integer or an array of integers
1660+
The end of the slice, broadcasted to `a`'s shape
16601661
1661-
step : the step for the slice, can be None, an integer or
1662-
an array of integers which can be broadcasted to`a`'s shape
1662+
step : None, an integer or an array of integers
1663+
The step for the slice, broadcasted to `a`'s shape
16631664
16641665
Returns
16651666
-------
16661667
out : ndarray
1667-
Output array of str or unicode, depending on input type
1668+
Output array of ``StringDType``, ``bytes_`` or ``str_`` dtype,
1669+
depending on input type
16681670
16691671
Examples
16701672
--------

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy