- Hands-On Python Deep Learning for the Web
- Anubhav Singh Sayak Paul
- 80字
- 2021-06-24 16:23:30
Array slicing over multiple rows and columns
While it is not possible to slice lists of lists in Python in such a way as to select a specific number of rows and columns in the list of lists, NumPy array slicing works according to the following syntax:
Array [ rowStartIndex : rowEndIndex, columnStartIndex : columnEndIndex ]
Here's an example:
In the preceding example, we are able to select two rows and all elements of those rows in NumPy array a.