You may find -1 index in python list and numpy array. Wht does it mean? In this tutorial, we will use some examples to help you understand it.
Preliminary
-1 index, which means we will get the last item in python list or numpy array.
Python list -1 index
As to this example:
list_data = ['tutorialexample.com', 'python', 1, 2, 3] print(list_data[-1])
The result is: 3
NumPy array -1 index
import numpy as np np_data = np.array(list_data) print(np_data[-1])
The result is also to be 3.