numpy.core.defchararray.index (arr, sub, start = 0, end = None) — this is another function for doing string operations in numpy. It returns the lowest index in the string where the sub string is found for each element in arr . Returns the error value if sub is not contained in the range
[start, end] .
arr : array_like of str or unicode.
sub: [str or unicode] The substring which to be searched.
start: [ int, optional] The starting location in each string.
end: [int, optional] The ending location in each string.
Returns: strong> [ndarray] Output array of int.
Code # 1:
Input array: ['aAaAaA'' baA' 'abBABba'] Output array: [0 1 0]
Code # 2:
Input array: ['aAaAaA'' aA' 'abBABba'] Output array: [1 1 3]
Code # 3: if the substring is not found, call ValueErro r.
ValueError: substring not found
Python Data Science Handbook: Essential Tools for Working with Data - PDF, 1st Edition For many researchers, Python is a first-class tool, primarily because of its libraries for storing, manipulati...
For courses in business intelligence or decision support systems. A managerial approach to understanding business intelligence systems. To help future managers use and understand analytics, Business...
Automate the Boring Stuff with Python PDF, 2nd Edition: Practical Programming for Total Beginners Illustrated Edition. The second edition of this Python bestseller (over 100,000 copies sold in prin...
Data is “unreasonably effective”. Nobel laureate Eugene Wigner referred to the unreasonable effectiveness of mathematics in the natural sciences. What is big data? Its sizes are in the order of te...