| [ Web Proxy ] |
| Viewing: https://numpy.org/doc/stable/reference/generated/../generated/../generated/numpy.char.replace.html | [Back] [Original] |
For each element in a, return a copy of the string with
occurrences of substring old replaced by new.
bytes_ or str_ dtypebytes_ or str_ dtypeint_ dtypeIf the optional argument count is given, only the first
count occurrences are replaced.
Output array of StringDType, bytes_ or str_ dtype,
depending on input types
See also
Examples
>>> import numpy as np
>>> a = np.array(["That is a mango", "Monkeys eat mangos"])
>>> np.strings.replace(a, 'mango', 'banana')
array(['That is a banana', 'Monkeys eat bananas'], dtype='<U19')
>>> a = np.array(["The dish is fresh", "This is it"])
>>> np.strings.replace(a, 'is', 'was')
array(['The dwash was fresh', 'Thwas was it'], dtype='<U19')
| Web Proxy Viewer | New URL | Original Page |