[Tutor] Extract several arrays from a large 2D array
Ek Esawi
esawiek at gmail.com
Thu Jan 21 23:27:34 EST 2016
Thank you all for your help. I am a decent programmer in another language
but new to Python and I have some issues with a project I am working on.
Some suggested using pandas but I am barley starting on Numpy. The
suggestions were very helpful, however, I decided to replace the 2D array
with several single arrays b/c the arrays are of different data types. I
ran into another problems and am almost done but got stuck.
Part of my code is below. The question is how to put the variables for each
j into a 14 by 6 array by a statement at the end of this code. I was hoping
to get an array like this one below:
[2013 TT1 TT2 TT3 TT4 TT5 TT6]
[2012TT1 TT2 TT3
TT4 TT5 TT6]
.
.
[1999TT1 TT2 TT3
TT4 TT5 TT6]
for j in range(14)
for i in range(200):
if TYear[i]==2013-j:
if TTrea[i]=='T1':
TT1+=TTemp[i]
elif TTrea[i]=='T2':
TT2+=TTemp[i]
elif TTrea[i]=='T3':
TT3+=TTemp[i]
elif TTrea[i]=='T4':
TT4+=TTemp[i]
elif TTrea[i]=='T5':
TT5+=TTemp[i]
elif TTrea[i]=='T6':
TT6+=TTemp[i]
More information about the Tutor
mailing list