Re: [Numpy-discussion] select column based on another column value

2013-10-09 Thread Roelf Schreurs
), 4.267) Roelf From: numpy-discussion-boun...@scipy.org [mailto:numpy-discussion-boun...@scipy.org] On Behalf Of Georgios Exarchakis Sent: 09 October 2013 15:22 To: Discussion of Numerical Python Subject: Re: [Numpy-discussion] select column based on another column value I think you need

Re: [Numpy-discussion] select column based on another column value

2013-10-09 Thread Georgios Exarchakis
I think you need this >>> testdata[testdata[:,0]==today][:,2].mean() 4.267 >>> testdata[testdata[:,0]==yesterday][:,2].mean() 5.634 >>> testdata[testdata[:,0]==twodaysago][:,2].mean() 2.9336 On 10/09/2013 06:46 AM, Roelf Schreurs wrote: Hi I have the fol

Re: [Numpy-discussion] select column based on another column value

2013-10-09 Thread Roelf Schreurs
Hi I have the following array and want to calculate the average per day. Import numpy as np from datetime import date today = date(today.year, today.month, 9) yesterday = date(today.year, today.month, 8) twodaysago = date(today.year, today.month, 7) testdata = np.array([[today, "r", 3.2],[toda