[Numpy-discussion] very simple iteration question.
Nadav Horesh
nadavh@visionsense....
Wed Apr 30 03:17:35 CDT 2008
for i in range(52):
week_data = data[:,i,:]
OR
for week_data in data.transpose(1,0,2):
...
Nadav
-----הודעה מקורית-----
מאת: numpy-discussion-bounces@scipy.org בשם a g
נשלח: ד 30-אפריל-08 11:11
אל: numpy-discussion@scipy.org
נושא: [Numpy-discussion] very simple iteration question.
Hi. This is a very basic question, sorry if it's irritating. If i
didn't find the answer written already somewhere on the site, please
point me to it. That'd be great.
OK: how do i iterate over an axis other than 0?
I have a 3D array of data[year, week, location]. I want to iterate
over each year at each location and run a series of stats on the
columns (on the 52 weeks in a particular year at a particular location).
'for years in data:' will get the first one, but then how do i not
iterate over the 1 axis and iterate over the 2 axis instead?
thanks,
alex.
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion
More information about the Numpy-discussion
mailing list