I want to ask a question about finding the position of an element within an array in Python's numpy package.
I am using Jupyter Notebook for Python 3 and have the following code illustrated below:
concentration_list = array([172.95, 173.97, 208.95])
and I want to write a block of code that would be able to return the position of an element within the array.
For this purpose, I wanted to use 172.95
to demonstrate.
Initially, I attempted to use .index()
, passing in 172.95
inside the parentheses but this did not work as numpy does not recognise the .index()
method -
concentration_position = concentration_list.index(172.95)
AttributeError: 'numpy.ndarray' object has no attribute 'index'
The Sci.py documentation did not mention anything about such a method being available when I accessed the site.
Is there any function available (that I may not have discovered) to solve the problem?