[Tutor] trying to change the number of elements in array while preserving data
Bryan Fodness
bryan.fodness at gmail.com
Wed Jun 4 22:47:05 CEST 2008
I tried posting this to numpy, but my posts never show up. So, I was hoping
someone here might be able to help me.
I have two arrays that are different sizes and i would like to be able
to add them for plotting.
If I have an array a and b,
[[1 2 3 4 5 6 7 8 9]
[1 2 3 4 5 6 7 8 9]
[1 2 3 4 5 6 7 8 9]
[1 2 3 4 5 6 7 8 9]
[1 2 3 4 5 6 7 8 9]
[1 2 3 4 5 6 7 8 9]
[1 2 3 4 5 6 7 8 9]
[1 2 3 4 5 6 7 8 9]
[1 2 3 4 5 6 7 8 9]
[1 2 3 4 5 6 7 8 9]]
[[0 0 0 0 0]
[0 3 3 3 0]
[0 3 3 3 0]
[0 3 3 3 0]
[0 0 0 0 0]]
but I would like to change b to look like this,
[[0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0]
[0 0 3 3 3 3 3 0 0]
[0 0 3 3 3 3 3 0 0]
[0 0 3 3 3 3 3 0 0]
[0 0 3 3 3 3 3 0 0]
[0 0 3 3 3 3 3 0 0]
[0 0 3 3 3 3 3 0 0]
[0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0]]
so I can get the sum of a and b.
My data will not be regular like these. I have a 400x60 array with
irregular data that I would like as a 400x400 array. Does anybody
know of an easy way to accomplish this?
Bryan
--
"The game of science can accurately be described as a never-ending insult to
human intelligence." - João Magueijo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080604/0379dfe2/attachment.htm>
More information about the Tutor
mailing list