bundles / numpy 2.4.3 / numpy / strings / mod
_ArrayFunctionDispatcher
numpy.strings:mod
source: /numpy/_core/strings.py :217
Signature
def mod ( a , values ) Summary
Return (a % i), that is pre-Python 2.6 string formatting (interpolation), element-wise for a pair of array_likes of str or unicode.
Parameters
a: array_like, with `np.bytes_` or `np.str_` dtypevalues: array_like of valuesThese values will be element-wise interpolated into the string.
Returns
out: ndarrayOutput array of
StringDType,bytes_orstr_dtype, depending on input types
Examples
import numpy as np a = np.array(["NumPy is a %s library"]) np.strings.mod(a, values=["Python"])✓
a = np.array([b'%d bytes', b'%d bits']) values = np.array([8, 64]) np.strings.mod(a, values)✓
Aliases
-
numpy.char.mod