Aug-06-2020, 10:02 PM
Index only works on 1D lists because that is all there is in Python, You can make something that looks like a 2D list but it is really just a list of lists. That is why our index() call failed. Your list "sampleArray" only contains lists. None of these lists is '2020-07-25' or 9679, so index() correctly raises a ValueError.
bowlofred's numpy example works because numpy understands lists that contain lists that contain lists and knows how to do a deep search.
bowlofred's numpy example works because numpy understands lists that contain lists that contain lists and knows how to do a deep search.