How can I find the index position of items in a list which satisfy a certain condition? Like suppose, I have a list like:
myList = [0, 100, 335, 240, 300, 450, 80, 500, 200] And the condition is to find out the position of all elements within myList which lie between 0 and 300 (both inclusive). I am expecting the output as:
output = [0, 1, 3, 4, 6, 8] How can I do this in pandas?
Also, how to find out the index of the maximum element in the subset of elements which satisfy the condition? Like, in the above case, out of the elements which satisfy the given condition 300 is the maximum and its index is 4. So, need to retrieve its index.
I have been trying many ways but not getting the desired result. Please help, I am new to the programming world.
myListinpandas? Is it a column, or it's supposed to be alistand notpandas?