7

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?

5
  • 6
    a[:, k] = values. You would have found that in any NumPy tutorial. Commented May 22, 2014 at 18:23
  • @larsmans that is definitely the answer. Commented May 22, 2014 at 19:53
  • 1
    @larsmans perhaps you can post your comment as the answer Commented May 28, 2014 at 23:01
  • @SaulloCastro You may post it if you want, I'm not interested in this basic stuff. Commented May 29, 2014 at 9:20
  • 1
    possible duplicate of Replacing numpy array values python Commented May 29, 2014 at 11:57

2 Answers 2

6

Never too late to answer...

a[:, k] = values
Sign up to request clarification or add additional context in comments.

Comments

1

This fills the same value in all columns:

  array[:, column] = values

1 Comment

The question was how to fill up an entire column, not how to fill all columns with the same value.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.