a
is a list:
In [61]: a = [None, 1,2,3,4]
In [62]: a
Out[62]: [None, 1, 2, 3, 4]
In [63]: a[1:] # standard list slicing
Out[63]: [1, 2, 3, 4]
If we have an array, we can do the same slicing:
In [64]: A = np.array(a)
In [65]: A
Out[65]: array([None, 1, 2, 3, 4], dtype=object)
In [66]: A[1:]
Out[66]: array([1, 2, 3, 4], dtype=object)
In [67]: A[1:].astype(int)
Out[67]: array([1, 2, 3, 4])
With None
the array is object dtype, similar to a list.
With the list, we can also us del
(and remove any selected item):
In [68]: a
Out[68]: [None, 1, 2, 3, 4]
In [69]: del a[0]
In [70]: a
Out[70]: [1, 2, 3, 4]
np.delete
does something similar for an array, though it isn't as efficient:
In [72]: np.delete(A, 0)
Out[72]: array([1, 2, 3, 4], dtype=object)
If np.delete
doesn't work for you, it's because you've messed up np
.