Hi Travis,
Very Strange. I am on version 1.6.2 L
What could I be missing. I started using numpy quite recently. Is there a way to share the data with you?
Regards,
Alok Jadhav
GAT IT Hong Kong
+852 2101 6274 (*852 6274)
From: numpy-discussion-bounces@scipy.org [mailto:numpy-discussion-bounces@scipy.org] On Behalf Of Travis Oliphant
Sent: Tuesday, September 11, 2012 11:58 AM
To: Discussion of Numerical Python
Subject: Re: [Numpy-discussion] numpy sort is not working
Hey Alok,
This is worth taking a look. What version of NumPy are you using?
It is not related directly to the issue you referenced as that was an endian-ness issue and your data is native-order.
Your example seems to work for me (with a simulated case on 1.6.1)
Best,
-Travis
On Sep 10, 2012, at 10:46 PM, Jadhav, Alok wrote:
Hi everyone,
I have a numpy array of dimensions
>>> allRics.shape
(583760, 1)
To sort the array, I set the dtype of the array as follows:
allRics.dtype = [('idx', np.float), ('opened', np.float), ('time', np.float),('trdp1',np.float),('trdp0',np.float),('dt',np.float),('value',np.float)]
>>> allRics.dtype
dtype([('idx', '<f8'), ('opened', '<f8'), ('time', '<f8'), ('trdp1', '<f8'), ('trdp0', '<f8'), ('dt', '<f8'), ('value', '<f8')])
I checked and the endianness in dtype is correct.
When I sort the array, the output array of sort is same as original array without any change. I want to sort the allRics numpy array on ‘time’. I do the following.
>>> x=np.sort(allRics,order='time')
>>> x[17330:17350]['time']
array([[ 61184.4 ],
[ 61188.51 ],
[ 61188.979],
[ 61188.979],
[ 61189.989],
[ 61191.66 ],
[ 61194.35 ],
[ 61194.35 ],
[ 61198.79 ],
[ 61198.145],
[ 36126.217],
[ 36126.217],
[ 36126.218],
[ 36126.218],
[ 36126.219],
[ 36126.271],
[ 36126.271],
[ 36126.271],
[ 36126.293],
[ 36126.293]])
Time column doesn’t change its order. Could someone please advise what is missing here? Is this related to the bug
Regards,
Alok
Alok Jadhav
CREDIT SUISSE AG
GAT IT Hong Kong, KVAG 67
International Commerce Centre | Hong Kong | Hong Kong
Phone +852 2101 6274 | Mobile +852 9169 7172
==============================================================================
Please access the attached hyperlink for an important electronic communications disclaimer:
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
==============================================================================
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion
==============================================================================
Please access the attached hyperlink for an important electronic communications disclaimer:
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
==============================================================================