Re: [Numpy-discussion] Structured array creation with list of lists and others

2017-03-26 Thread Kirill Balunov
is that in some cases numpy allows a lot freedom, but in other it is unnecessarily strict. Another one is exception messages (but this is certainly subjective). 2017-03-24 19:48 GMT+03:00 Allan Haldane : > On 03/23/2017 02:16 PM, Kirill Balunov wrote: > > It was the first time I tried to

[Numpy-discussion] Sorting of an array row-by-row?

2017-10-20 Thread Kirill Balunov
Hi, I was trying to sort an array (N, 3) by rows, and firstly come with this solution: N = 100 arr = np.random.randint(-100, 100, size=(N, 3)) dt = np.dtype([('x', int),('y', int),('z', int)]) *arr.view(dtype=dt).sort(axis=0)* Then I found another way using lexsort function *:* *idx = np.

Re: [Numpy-discussion] Sorting of an array row-by-row?

2017-10-20 Thread Kirill Balunov
axis=1. You actually > want to iterate over the columns, so np.lexsort(a.T) is the correct > phrasing of that. No idea about the speed difference. > >-Joe > > On Fri, Oct 20, 2017 at 6:00 AM, Kirill Balunov > wrote: > > Hi, > > > > I was trying to sort

Re: [Numpy-discussion] Type annotations for NumPy

2017-11-26 Thread Kirill Balunov
Hi! 2017-11-26 4:31 GMT+03:00 Juan Nunez-Iglesias : > > On 26 Nov 2017, 12:27 PM +1100, Nathaniel Smith , wrote: > > It turns out that the PEP 484 type system is *mostly* not useful for > this. They're really designed for checking consistency across a large > code-base, not for enabling compiler

Re: [Numpy-discussion] What is the pythonic way to write a function that handles arrays and scalars?

2017-12-12 Thread Kirill Balunov
On minor thing that instead of 'ret' there should be 'x'. With kind regards, -gdg On Dec 12, 2017 22:51, "Joe" wrote: Hi, the best example I found was this one: https://stackoverflow.com/a/29319864/7919597 def func_for_scalars_or_vectors(x): x = np.asarray(x) scalar_input = False

Re: [Numpy-discussion] What is the pythonic way to write a function that handles arrays and scalars?

2017-12-12 Thread Kirill Balunov
Oh, sorry for noise... With kind regards, -gdg On Dec 12, 2017 23:05, "Robert Kern" wrote: > On Wed, Dec 13, 2017 at 5:00 AM, Kirill Balunov > wrote: > > > > On minor thing that instead of 'ret' there should be 'x'. > > No, `x` is the inpu

[Numpy-discussion] dtype argument description for np.array

2018-02-09 Thread Kirill Balunov
Currently in docstring the description of dtype argument for np.array says this: dtype : data-type, optional > The desired data-type for the array. If not given, then the type will > be determined as the minimum type required to hold the objects in the > sequence. This argument can o

[Numpy-discussion] type promotion rules for integers

2018-02-09 Thread Kirill Balunov
What considerations formed the basis for choosing the next type promotion behavior in numpy: In[2] : a = np.array([10], dtype=np.int64) b = np.array([10], dtype=np.uint64) (a+b).dtype Out[2]: dtype('float64') Why the `object` dtype was not chosen for the resulting dtype? Are ther

Re: [Numpy-discussion] Syntax Improvement for Array Transpose

2019-06-25 Thread Kirill Balunov
вт, 25 июн. 2019 г. в 21:20, Cameron Blocker : > It seems to me that the general consensus is that we shouldn't be changing > .T to do what we've termed matrix transpose or conjugate transpose. > Reading through this thread, I can not say that I have the same opinion - at first, many looked posit

Re: [Numpy-discussion] Syntax Improvement for Array Transpose

2019-06-26 Thread Kirill Balunov
Only concerns #4 from Ilhan's list. ср, 26 июн. 2019 г. в 00:01, Ralf Gommers : > > [] > > Perhaps not full consensus between the many people with different opinions > and interests. But for the first one, arr.T change: it's clear that this > won't happen. > To begin with, I must admit that