Using take or array or similar operations on the initial list
descends ignoring the tuples and converting the list to a multiple-
dimension array:
>>> take(keys,[1,0],axis=0)
array([['b', '2'],
['a', '1']],
dtype='|S4')
It is sorted as I want, but I can no-longer use them as keys
Hi,
That is a little more complicated than I want, but it shows me the
solution: Construct the array of the desired shape first, then fill it.
data = [1.0, 3,0]
keys = [('a',1),('b',2)]
# Convert to arrays for indexing
data_array = array(data1)
key_array = empty(len(keys),dtype=tuple)
key_arra
> These are both correct. See my previous posts about the rule.
>
> The first case is exactly the example we saw before: we start with a
> (1,10,10)-shaped array and replace the first and last-dimension
> (1,10)-shaped array with a (5,)-shaped array. Not having a clear place
> to put the extrac
Travis Oliphant schrieb:
> Sturla Molden wrote:
>> >>> x = numpy.arange(100).reshape((1,10,10))
>>
>> >>> x[0,:,numpy.arange(5)].shape
>> (5, 10)
>>
>> >>> x[:,:,numpy.arange(5)].shape
>> (1, 10, 5)
>>
>>
>> It looks like a bug that needs to be squashed.
>>
>
> These are both correct. See m
Sturla Molden wrote:
> >>> x = numpy.arange(100).reshape((1,10,10))
>
> >>> x[0,:,numpy.arange(5)].shape
> (5, 10)
>
> >>> x[:,:,numpy.arange(5)].shape
> (1, 10, 5)
>
>
> It looks like a bug that needs to be squashed.
>
These are both correct. See my previous posts about the rule.
The firs
Sturla Molden wrote:
> On 6/19/2007 12:19 PM, Sven Schreiber wrote:
>
>
>> To be more specific, I would expect shape==(4,14).
>>
>
>
> >>> h = numpy.zeros((1,4,14))
> >>> h[0,:,numpy.arange(14)].shape
> (14, 4)
> >>> h[0,:,:].shape
> (4, 14)
> >>>
>
>
> h[0,:,numpy.arange(14)] is a case
Stefan van der Walt wrote:
> On Tue, Jun 19, 2007 at 12:35:05PM +0200, Sturla Molden wrote:
>
>> On 6/19/2007 12:14 PM, Sturla Molden wrote:
>>
>>
>>> h[0,:,numpy.arange(14)] is a case of "sdvanced indexing". You can also
>>> see that
>>>
>>> >>> h[0,:,[0,1,2,3,4,5,6,7,8,9,10,11,12,13]].s
On 6/20/07, Michael McNeil Forbes <[EMAIL PROTECTED]> wrote:
Hi,
I have a list of tuples that I am using as keys and I would like to
sort this along with some other arrays using argsort. How can I do
this? I would like to do something like:
You might want the keys in an object array, other
On 6/20/07, Jon Wright <[EMAIL PROTECTED]> wrote:
> "Charles R Harris" <[EMAIL PROTECTED]> wrote:
>
> Straight radix sort might be an interesting option for some things.
> However, its performance can depend on whether the input data is random
or
> not and it takes up more space than merge sort.
El dc 20 de 06 del 2007 a les 01:38 -0700, en/na Michael McNeil Forbes
va escriure:
> Hi,
>
> I have a list of tuples that I am using as keys and I would like to
> sort this along with some other arrays using argsort. How can I do
> this? I would like to do something like:
>
> # These are c
> "Charles R Harris" <[EMAIL PROTECTED]> wrote:
>
> Straight radix sort might be an interesting option for some things.
> However, its performance can depend on whether the input data is random or
> not and it takes up more space than merge sort. Other potential drawbacks
> arise from the bit twi
Hi,
This was discussed some time ago (I started it because I had exactly the
same problem), numpy is not responsible for this, Python is. Python uses the
C standard library and in C by MS, NaN and Inf can be displayed, but not
read from a string, so this is the behaviour displayed here.
Wait for
Hi,
I have a list of tuples that I am using as keys and I would like to
sort this along with some other arrays using argsort. How can I do
this? I would like to do something like:
# These are constructed using lists because they accumulate using
append()
data = [1.0, 3,0]
keys = [('a',1),
Hi
Is there a reason for numpy.float not to convert it's own string
representation correctly?
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit
(Intel)] on win32>>> import numpy
>>> numpy.__version__
'1.0.3'
>>> numpy.float("1.0")
1.0
>>> numpy.nan
-1.#IND
>>> numpy.float("-1.#I
14 matches
Mail list logo