for i in range(52):
   week_data = data[:,i,:]

OR

for week_data in data.transpose(1,0,2):
   ...

  Nadav


-----הודעה מקורית-----
מאת: [EMAIL PROTECTED] בשם a g
נשלח: ד 30-אפריל-08 11:11
אל: [email protected]
נושא: [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
[email protected]
http://projects.scipy.org/mailman/listinfo/numpy-discussion

_______________________________________________
Numpy-discussion mailing list
[email protected]
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to