Skip to content

Python code snippet – How to change the values of a column in numpy array?

>>> a = np.zeros((2,2), dtype=np.int)
>>> a[:, 0] =  1
>>> a
array([[1, 0],
       [1, 0]])
See also  Python code snippet - How to create tensor with tensorflow?
, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.