Skip to content

Commit 98b5aa5

Browse files
committed
DOC: add char.mod example
[skip actions][skip azp][skip cirrus]
1 parent 563a98e commit 98b5aa5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

numpy/_core/strings.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,14 @@ def mod(a, values):
196196
out : ndarray
197197
Output array of ``StringDType``, ``bytes_`` or ``str_`` dtype,
198198
depending on input types
199-
199+
200+
Examples
201+
--------
202+
>>> np.char.mod("%.3f", [1, 2, 3])
203+
array(['1.000', '2.000', '3.000'], dtype='<U5')
204+
>>> np.char.mod("0x%02x", [8, 9, 10, 11])
205+
array(['0x08', '0x09', '0x0a', '0x0b'], dtype='<U4')
206+
200207
"""
201208
return _to_bytes_or_str_array(
202209
_vec_string(a, np.object_, '__mod__', (values,)), a)

0 commit comments

Comments
 (0)