bundles / numpy 2.4.3 / numpy / strings / multiply
_ArrayFunctionDispatcher
numpy.strings:multiply
source: /numpy/_core/strings.py :148
Signature
def multiply ( a , i ) Summary
Return (a * i), that is string multiple concatenation, element-wise.
Extended Summary
Values in i of less than 0 are treated as 0 (which yields an empty string).
Parameters
a: array_like, with ``StringDType``, ``bytes_`` or ``str_`` dtypei: array_like, with any integer dtype
Returns
out: ndarrayOutput array of
StringDType,bytes_orstr_dtype, depending on input types
Examples
import numpy as np a = np.array(["a", "b", "c"]) np.strings.multiply(a, 3) i = np.array([1, 2, 3]) np.strings.multiply(a, i) np.strings.multiply(np.array(['a']), i) a = np.array(['a', 'b', 'c', 'd', 'e', 'f']).reshape((2, 3)) np.strings.multiply(a, 3) np.strings.multiply(a, i)✓
Aliases
-
numpy.strings.multiply