Re: [Tutor] Change datatype for specific columns in an 2D array & computing the mean

2016-01-28 Thread Ek Esawi
Thank you SO MUCH Oscar and others. This is exactly what i wanted to get. I think i can take it form here. I spent hours looking at different ways to figure it out and i came close. I tried numpy.genfromtxt, numpy.loadtext, json, etc. I am at the moment learning how to open various data files with

Re: [Tutor] Change datatype for specific columns in an 2D array & computing the mean

2016-01-28 Thread Oscar Benjamin
On 27 January 2016 at 23:00, Ek Esawi wrote: > Ops..here is the text file.; previously i copied and pasted from either > Word or Excel. > > > AA,BB,CC,DD,EE > 1,A1,B1,11.2,11/20/2011 > 2,A2,B2,2.5,10/21/2011 > 3,A3,B3,13.67,9/21/2011 > 4,A4,B4,14.2,8/22/2011 > 5,A5,B5,20,7/23/2011 Finally! That's

Re: [Tutor] Change datatype for specific columns in an 2D array & computing the mean

2016-01-27 Thread Ek Esawi
Ops..here is the text file.; previously i copied and pasted from either Word or Excel. AA,BB,CC,DD,EE 1,A1,B1,11.2,11/20/2011 2,A2,B2,2.5,10/21/2011 3,A3,B3,13.67,9/21/2011 4,A4,B4,14.2,8/22/2011 5,A5,B5,20,7/23/2011 ___ Tutor maillist - Tutor@python.o

Re: [Tutor] Change datatype for specific columns in an 2D array & computing the mean

2016-01-27 Thread Ek Esawi
Sorry for the mishap. There are no blank lines on the file. I just did not delete the blank lines when i copied and pasted. Here it's again. EK *AA,BB,CC,DD,EE* *1,A1,B1,11.2,11/20/2011* *2,A2,B2,2.5,10/21/2011* *3,A3,B3,13.67,9/21/2011* *4,A4,B4,14.2,8/22/2011* *5,A5,B5,20,7/23/2011* ___

Re: [Tutor] Change datatype for specific columns in an 2D array & computing the mean

2016-01-27 Thread Oscar Benjamin
On 27 January 2016 at 02:00, Ek Esawi wrote: > Here is the file. > > AA,BB,CC,DD,EE > > 1,A1,B1,11.2,11/20/2011 > > 2,A2,B2,2.5,10/21/2011 > > 3,A3,B3,13.67,9/21/2011 > > 4,A4,B4,14.2,8/22/2011 > > 5,A5,B5,20,7/23/2011 That still doesn't look right to me. Is there really a blank line between each

Re: [Tutor] Change datatype for specific columns in an 2D array & computing the mean

2016-01-27 Thread Ek Esawi
Here is the file. AA,BB,CC,DD,EE 1,A1,B1,11.2,11/20/2011 2,A2,B2,2.5,10/21/2011 3,A3,B3,13.67,9/21/2011 4,A4,B4,14.2,8/22/2011 5,A5,B5,20,7/23/2011 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.p

Re: [Tutor] Change datatype for specific columns in an 2D array & computing the mean

2016-01-26 Thread Oscar Benjamin
On 26 Jan 2016 19:32, "Ek Esawi" wrote: > > Sorry! but it's a csv file. I just copied it directly from an opened csv > file in excel. And you're correct it looks like what you wrote. EKE Can you show exactly how it looks? I.e. open it in a text editor and paste the first say 20 lines here. -- Os

Re: [Tutor] Change datatype for specific columns in an 2D array & computing the mean

2016-01-26 Thread Ek Esawi
Sorry! but it's a csv file. I just copied it directly from an opened csv file in excel. And you're correct it looks like what you wrote. EKE ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mai

Re: [Tutor] Change datatype for specific columns in an 2D array & computing the mean

2016-01-26 Thread Oscar Benjamin
On 26 January 2016 at 03:07, Ek Esawi wrote: > > Here is a copy of my code and the csv file. > ++ csv file++ > > AA > > BB > > CC This doesn't look like a csv file. Is that what the actual contents of the csv file looks like if you open it in a *text editor*? If this was a csv file I'd expect

Re: [Tutor] Change datatype for specific columns in an 2D array & computing the mean

2016-01-26 Thread Ek Esawi
Thank you all for your patience and dedication to this noble effort-the list. I actually completed my project using Excel and python; unfortunately my python code is not a python-like at all b/c I used way too many loops and if statements. Plus I really want to learn python b/c I am a decent progra

Re: [Tutor] Change datatype for specific columns in an 2D array & computing the mean

2016-01-25 Thread Oscar Benjamin
On 25 January 2016 at 13:14, Peter Otten <__pete...@web.de> wrote: >> What do you mean by "group rows"? > > Given a table you can specify columns as keys and in the simplest case one > column where you apply an aggregate function over the sets of rows with the > same key. > > If I understand you co

Re: [Tutor] Change datatype for specific columns in an 2D array & computing the mean

2016-01-25 Thread Peter Otten
Oscar Benjamin wrote: > On 24 January 2016 at 17:24, Peter Otten <__pete...@web.de> wrote: >> >> I'm an amateur with numpy, and unfortunately my favourite search engine >> didn't come up with a numpy-specific way to group rows in a 2D array. > > What do you mean by "group rows"? Given a table yo

Re: [Tutor] Change datatype for specific columns in an 2D array & computing the mean

2016-01-25 Thread Oscar Benjamin
On 24 January 2016 at 17:24, Peter Otten <__pete...@web.de> wrote: > > I'm an amateur with numpy, and unfortunately my favourite search engine > didn't come up with a numpy-specific way to group rows in a 2D array. What do you mean by "group rows"? I thought the OP's problem is really to filter r

Re: [Tutor] Change datatype for specific columns in an 2D array & computing the mean

2016-01-24 Thread Albert-Jan Roskam
> To: tutor@python.org > From: __pete...@web.de > Date: Sun, 24 Jan 2016 11:22:19 +0100 > Subject: Re: [Tutor] Change datatype for specific columns in an 2D array & > computing the mean > How do you want to convert the second and third column to int? Are A4 and B2 &

Re: [Tutor] Change datatype for specific columns in an 2D array & computing the mean

2016-01-24 Thread Alan Gauld
On 24/01/16 14:09, Ek Esawi wrote: > BTW, is it possible to send you what i did off list? That way you see what > i am doing. The list is here so that everyone can benefit. Can you post the code publicly? If so, and its not more than say, 100-200 lines, you can just post it here. But I will repe

Re: [Tutor] Change datatype for specific columns in an 2D array & computing the mean

2016-01-24 Thread Peter Otten
Ek Esawi wrote: > Thanks for the input. Columns 2 and 3 are strings and i assume that they > don't need to be converted. Because all i need is to compute the mean for > data on column 4 based on each variable in column 1 and each in column 2.. I'm an amateur with numpy, and unfortunately my favou

Re: [Tutor] Change datatype for specific columns in an 2D array & computing the mean

2016-01-24 Thread Ek Esawi
Thanks for the input. Columns 2 and 3 are strings and i assume that they don't need to be converted. Because all i need is to compute the mean for data on column 4 based on each variable in column 1 and each in column 2.. BTW, is it possible to send you what i did off list? That way you see what i

Re: [Tutor] Change datatype for specific columns in an 2D array & computing the mean

2016-01-24 Thread Peter Otten
Ek Esawi wrote: > Hi All--- > > > > Sorry for posting again, but I have a problem that I tried several > different ways to solve w/o success. I approached the problem from one > angle and asked about it here; I got some good input using pandas, and > structured array, but I am new to python and

[Tutor] Change datatype for specific columns in an 2D array & computing the mean

2016-01-23 Thread Ek Esawi
Hi All--- Sorry for posting again, but I have a problem that I tried several different ways to solve w/o success. I approached the problem from one angle and asked about it here; I got some good input using pandas, and structured array, but I am new to python and not very familiar with either to