Re: [Tutor] Extract several arrays from a large 2D array

2016-01-22 Thread Peter Otten
Ek Esawi wrote: > 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

[Tutor] Extract several arrays from a large 2D array

2016-01-22 Thread Ek Esawi
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 severa

Re: [Tutor] Extract several arrays from a large 2D array

2016-01-21 Thread Peter Otten
Alan Gauld wrote: > So in pseudo code: > > data = {} > for row in myArray: > data.get((row[0],row[1]),[]).append row[3] Replace get() with setdefault() to go from pseudo to Python code. ___ Tutor maillist - Tutor@python.org To unsubscribe or ch

Re: [Tutor] Extract several arrays from a large 2D array

2016-01-21 Thread Peter Otten
Ek Esawi wrote: > Hi All-- > I have a 2D array (2000, 4); an example is given abelow. On the 1st > column I have 15 variables, on the 2nd 4 variables. Ignore column 3 for > now. I want a code that generate 4 arrays for each variable on the 1st > column; each array contains all the values from co

Re: [Tutor] Extract several arrays from a large 2D array

2016-01-21 Thread Oscar Benjamin
On 21 January 2016 at 04:22, Ek Esawi wrote: > I have a 2D array (2000, 4); Do you mean a numpy array? I'm going to assume that you do. > an example is given abelow. On the 1st column > I have 15 variables, on the 2nd 4 variables. Ignore column 3 for now. I > want a code that generate 4 arrays

Re: [Tutor] Extract several arrays from a large 2D array

2016-01-21 Thread Alan Gauld
On 21/01/16 04:22, Ek Esawi wrote: > I have a 2D array (2000, 4); an example is given abelow. On the 1st column > I have 15 variables, on the 2nd 4 variables. Your terminology is a little confusing since variables in Python normally means names. You have values in your columns. So I suspect whe

[Tutor] Extract several arrays from a large 2D array

2016-01-21 Thread Ek Esawi
Hi All-- I have a 2D array (2000, 4); an example is given abelow. On the 1st column I have 15 variables, on the 2nd 4 variables. Ignore column 3 for now. I want a code that generate 4 arrays for each variable on the 1st column; each array contains all the values from column 4. Then I want to fi