| [ Web Proxy ] |
| Viewing: https://numpy.org/doc/stable/reference/generated/../c-api/../generated/numpy.strings.count.html | [Back] [Original] |
Returns an array with the number of non-overlapping occurrences of
substring sub in the range [start, end).
StringDType, bytes_, or str_ dtypeStringDType, bytes_, or str_ dtypeThe substring to search for.
The range to look in, interpreted as in slice notation.
Output array of ints
See also
Examples
>>> import numpy as np
>>> c = np.array(['aAaAaA', ' aA ', 'abBABba'])
>>> c
array(['aAaAaA', ' aA ', 'abBABba'], dtype='<U7')
>>> np.strings.count(c, 'A')
array([3, 1, 1])
>>> np.strings.count(c, 'aA')
array([3, 1, 0])
>>> np.strings.count(c, 'A', start=1, end=4)
array([2, 1, 1])
>>> np.strings.count(c, 'A', start=1, end=3)
array([1, 0, 0])
| Web Proxy Viewer | New URL | Original Page |