Hello List,
I am teaching a Python programming class where students use their own
computer.
When I create an array with 3 rows and 4 columns, a = zeros((3,4)), and ask
for the shape, shape(a), then some students get (3,4), while others get
(3L,4L).
I guess the 3L and 4L are long integers. I
Hello list,
I am trying to find the indices of the maximum value in a 2D array.
argmax works fine, but returns the index in the flattened array.
That is often not very convenient.
Is there a function that returns the index of the row and column?
Or can the index of the flattened array easily be
Hi Mark,
You're looking for np.unravel_index function.
Cheers,
Gregorio
2013/9/13 Mark Bakker mark...@gmail.com:
Hello list,
I am trying to find the indices of the maximum value in a 2D array.
argmax works fine, but returns the index in the flattened array.
That is often not very
Are they all using the same platform ? I suspect you're seeing the (3L, 4L)
on windows 64 bits, correct ?
FWIW, the numpy provided in Canopy is straight up upstream numpy + few
patches not merged in releases yet, and any divergence from upstream would
be considered as a bug by the canopy
Thanks, Gregorio.
I would like it if argmax had a keyword option to return the row,column
index automatically (or whatever the dimension of the array).
Afterall, argmax already knows the shape of the array.
Calling np.unravel_index( np.argmax( A ) ) seems unnecessarily long. But it
works well
Now that you mention it, (3L,4L) probably indeed occurs on Windows 64 bit
installations.
Not sure about Mac 64 bit. I haven't tried that.
So, is it desirable that the 32bit returns different integers than the
64bit? I would guess not.
Thanks,
Mark
Are they all using the same platform ? I
Hi,
Le 13/09/2013 10:32, Mark Bakker a écrit :
Now that you mention it, (3L,4L) probably indeed occurs on Windows 64
bit installations.
Not sure about Mac 64 bit. I haven't tried that.
So, is it desirable that the 32bit returns different integers than the
64bit? I would guess not.
What I
On Fri, Sep 13, 2013 at 9:51 AM, Pierre Haessig pierre.haes...@crans.org
wrote:
Hi,
Le 13/09/2013 10:32, Mark Bakker a écrit :
Now that you mention it, (3L,4L) probably indeed occurs on Windows 64
bit installations.
Not sure about Mac 64 bit. I haven't tried that.
So, is it desirable
Hi Robert,
Le 13/09/2013 11:22, Robert Kern a écrit :
The Python `int` type represents a C `long` integer. On almost all
32-bit platforms, a C `long` is 32-bits, and memory addresses and
offsets are also 32-bits. On 64-bit platforms, memory addresses and
offsets are 64-bits, but nothing in
There's already been some dance around this topic, maybe you will find
the concept behind it:
http://search.gmane.org/?query=unravel_indexgroup=gmane.comp.python.numeric.general
2013/9/13 Mark Bakker mark...@gmail.com:
Thanks, Gregorio.
I would like it if argmax had a keyword option to
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
[sorry for crossposting]
Hi all,
After the success of last years workshop, we decided to hold the
Pytroll workshop this year again at SMHI.
Pytroll is a collection of free and open source python modules for the
reading, interpretation, and writing
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
[sorry for crossposting]
Hi all,
After the success of last years workshop, we decided to hold the
Pytroll workshop this year again at SMHI.
Pytroll is a collection of free and open source python modules for the
reading, interpretation, and writing
On Fri, Sep 13, 2013 at 4:27 AM, Mark Bakker mark...@gmail.com wrote:
Thanks, Gregorio.
I would like it if argmax had a keyword option to return the row,column
index automatically (or whatever the dimension of the array).
Afterall, argmax already knows the shape of the array.
Calling
Hi Christolph,
Could you debug this a bit?
ERROR: test_record_no_hash (test_multiarray.TestRecord)
--
Traceback (most recent call last):
File
X:\Python33\lib\site-
packages\numpy\core\tests\test_multiarray.py,
line 2464, in
14 matches
Mail list logo