Sean
Sean

Reputation: 1313

Python, How to fill up a column in an empty numpy array

I would normally go to

http://docs.scipy.org

for this info but their website is down for some reason:/

But how would I be able to fill up an entire column in a numpy matrix?

a = numpy.zeros(shape=(100,10))
a[0] = [1,2,3,4,5,6,7,8,9,0]

fills up a row, but how can you do a column?

Upvotes: 7

Views: 11275

Answers (2)

Saim Yousuf
Saim Yousuf

Reputation: 21

This fills the same value in all columns:

  array[:, column] = values

Upvotes: 1

dwp4ge
dwp4ge

Reputation: 2003

Never too late to answer...

a[:, k] = values

Upvotes: 6

Related Questions