<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
I think you need this<br>
<br>
>>> testdata[testdata[:,0]==today][:,2].mean()<br>
4.266666666666667<br>
<br>
>>> testdata[testdata[:,0]==yesterday][:,2].mean()<br>
5.633333333333334<br>
<br>
>>> testdata[testdata[:,0]==twodaysago][:,2].mean()<br>
2.9333333333333336<br>
<br>
<div class="moz-cite-prefix"><br>
On 10/09/2013 06:46 AM, Roelf Schreurs wrote:<br>
</div>
<blockquote
cite="mid:39665C187B885C4296F1D80EC22699D680DD3E7B@LCINF16.tibra.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<style>
<!--
@font-face
{font-family:Calibri}
@font-face
{font-family:Tahoma}
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif"}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{margin:0cm;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma","sans-serif"}
span.BalloonTextChar
{font-family:"Tahoma","sans-serif"}
span.EmailStyle19
{font-family:"Calibri","sans-serif";
color:windowtext}
span.EmailStyle20
{font-family:"Calibri","sans-serif";
color:#1F497D}
.MsoChpDefault
{font-size:10.0pt}
@page WordSection1
{margin:72.0pt 72.0pt 72.0pt 72.0pt}
-->
</style>
<div class="WordSection1">
<p class="MsoNormal">Hi</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">I have the following array and want to
calculate the average per day.
</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Import numpy as np</p>
<p class="MsoNormal">from datetime import date</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">today = date(today.year, today.month, 9)</p>
<p class="MsoNormal">yesterday = date(today.year, today.month,
8)</p>
<p class="MsoNormal">twodaysago = date(today.year, today.month,
7)</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">testdata = np.array([[today, "r",
3.2],[today, "r", 4.3],[today, "r", 5.3],[yesterday, "r",
6.3],[yesterday, "r", 9.3],[yesterday, "r", 1.3],[twodaysago,
"r", 3.3],[twodaysago, "r", 1.2],[twodaysago, "r", 4.3]])</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">which produces</p>
<p class="MsoNormal">array([[datetime.date(2013, 10, 9), 'r',
3.2],</p>
<p class="MsoNormal"> [datetime.date(2013, 10, 9), 'r',
4.3],</p>
<p class="MsoNormal"> [datetime.date(2013, 10, 9), 'r',
5.3],</p>
<p class="MsoNormal"> [datetime.date(2013, 10, 8), 'r',
6.3],</p>
<p class="MsoNormal"> [datetime.date(2013, 10, 8), 'r',
9.3],</p>
<p class="MsoNormal"> [datetime.date(2013, 10, 8), 'r',
1.3],</p>
<p class="MsoNormal"> [datetime.date(2013, 10, 7), 'r',
3.3],</p>
<p class="MsoNormal"> [datetime.date(2013, 10, 7), 'r',
1.2],</p>
<p class="MsoNormal"> [datetime.date(2013, 10, 7), 'r',
4.3]], dtype=object)</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">And I want the output as (numbers aren’t
correct below):</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">2013-10-09, 4.54</p>
<p class="MsoNormal">2013-10-08, 5.43</p>
<p class="MsoNormal">2013-10-07, 2.76</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">But not sure how.</p>
<p class="MsoNormal">Thanks</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;
font-family:"Arial","sans-serif""
lang="EN-US">Roelf
</span></b><span style="font-size:8.0pt;
font-family:"Arial","sans-serif";
color:black" lang="EN-US"></span></p>
<p class="MsoNormal"> </p>
</div>
<br>
<font color="Gray" face="Arial" size="1"><br>
Tibra Trading Europe Limited is Authorised and Regulated by the
FCA (Company No. 06061713)<br>
Tibra Global Services Pty Limited London Branch (Company No.
BR014370)<br>
Tibra Equities Europe Limited (Company No. 07283912)<br>
Registered in England & Wales - Level 12, 5 Aldermanbury
Square London EC2V 7HR<br>
<br>
Unless otherwise stated, this communication is neither an offer
nor solicitation of an offer to sell or purchase any investment<br>
</font><br>
<font color="Gray" face="Arial" size="1"><br>
The contents of this email including any attachments are
confidential. If you have received this email in error, please
advise the sender by return email and delete this email. Any
unauthorised use of the contents of the email is prohibited and
you must not disseminate, copy or distribute the message or use
the information contained in the email or its attachments in any
way.<br>
<br>
The views or opinions expressed are the author's own and may not
reflect the views or opinions of Tibra. Tibra does not guarantee
the integrity of any emails or attached files. E-mails may be
interfered with, may contain computer viruses or other defects.
Under no circumstances do we accept liability for any loss or
damage which may result from your receipt of this message or any
attachments.<br>
</font>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
NumPy-Discussion mailing list
<a class="moz-txt-link-abbreviated" href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a>
<a class="moz-txt-link-freetext" href="http://mail.scipy.org/mailman/listinfo/numpy-discussion">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a>
</pre>
</blockquote>
<br>
</body>
</html>