slice create new array python code example
Example 1: python array slice
>>> a[1:4]
[2, 3, 4]
Example 2: python slice second element of list of lists
import numpy as np
A = np.array([[1,2,3,4,5],[1,2,3,4,5],[1,2,3,4,5]])
A[:,:3]
Out[3]:
array([[1, 2, 3],
[1, 2, 3],
[1, 2, 3]])