Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to access rows and columns indexing numpy

>>> a[[0,1,3], :]            # Returns the rows you want
array([[ 0,  1,  2,  3],
       [ 4,  5,  6,  7],
       [12, 13, 14, 15]])
>>> a[[0,1,3], :][:, [0,2]]  # Selects the columns you want as well
array([[ 0,  2],
       [ 4,  6],
       [12, 14]])
Comment

PREVIOUS NEXT
Code Example
Python :: initialize boolean list of size python 
Python :: __pycache__ 
Python :: uneven chunks of array slices 
Python :: tcs question 
Python :: how ti maek a prinyt comnad i pyuthon 
Python :: mp.solutions.findhands not in python 3.8 
Python :: open tkinter and cli 
Python :: how to put 2 code n 1 line in python 
Python :: create file and store output python 
Python :: how to restore windows security 
Python :: how to get max id in mongodb python 
Python :: len range 
Python :: pytest using tempfile 
Python :: python file write all the bounding box coordinates using opencv 
Python :: datetime german format python 
Python :: messe graphen erstellen python 
Python :: simple example of printing a C version of a SymPy expression: 
Python :: matplotlib annotate align center 
Python :: get value of a list of dictionary matching key 
Python :: launch application from python 
Python :: wikipedia api python 
Python :: django user_passes_test 
Python :: python pandas if statement 
Python :: json.dump 
Python :: python oops 
Python :: leetcode solutions python 
Python :: how to access variable of one function in another function in python 
Python :: python list tutorial 
Python :: string functions 
Python :: getting url parameters with javascript 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =