Maybe something along the lines of... indices = [i for i, val in enumerate(x) where 0 <= val <= 15000]
-----Original Message----- From: Python-list [mailto:python-list-bounces+david.raymond=tomtom....@python.org] On Behalf Of Madhavan Bomidi Sent: Thursday, January 10, 2019 12:05 PM To: python-list@python.org Subject: Re: How can I find the indices of an array with float values in python? Sorry for re-posting with a correction. I have an array (numpy.ndarray) with shape (1500L,) as below: x = array([ 3.00000000e+01, 6.00000000e+01, 9.00000000e+01, ..., 4.49400000e+04, 4.49700000e+04, 4.50000000e+04]) Now, I wanted to determine the indices of the x values between 0.0 and 15000.0. While this is simple in MATLAB or IDL by using find or where functions, I was unable to find a best way to find the indices of all elements between 0.0 and 15000.0 in the x array. Can you please suggest me a solution for the same? -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list