Re: [Numpy-discussion] Can't seem to use np.insert() or np.append() for structured arrays

2014-08-30 Thread Sebastian Berg
On Fr, 2014-08-29 at 22:10 -0400, Benjamin Root wrote: Consider the following: a = np.array([(1, 'a'), (2, 'b'), (3, 'c')], dtype=[('foo', 'i'), ('bar', 'a1')]) b = np.append(a, (4, 'd')) Traceback (most recent call last): File stdin, line 1, in module File

Re: [Numpy-discussion] Can't seem to use np.insert() or np.append() for structured arrays

2014-08-30 Thread Sebastian Berg
On Sa, 2014-08-30 at 09:04 +0100, Sebastian Berg wrote: On Fr, 2014-08-29 at 22:10 -0400, Benjamin Root wrote: Consider the following: a = np.array([(1, 'a'), (2, 'b'), (3, 'c')], dtype=[('foo', 'i'), ('bar', 'a1')]) b = np.append(a, (4, 'd')) Traceback (most recent call last):

Re: [Numpy-discussion] inplace unary operations?

2014-08-30 Thread Nathaniel Smith
On Sat, Aug 30, 2014 at 6:43 PM, josef.p...@gmail.com wrote: Is there a way to negate a boolean, or to change the sign of a float inplace ? np.logical_not(arr, out=arr) np.negative(arr, out=arr) -n -- Nathaniel J. Smith Postdoctoral researcher - Informatics - University of Edinburgh

Re: [Numpy-discussion] inplace unary operations?

2014-08-30 Thread Benjamin Root
Random thoughts are the best kinds of thoughts! I didn't even know there was a np.negative() function! I will keep this card up my sleeve at work for one of those save-the-day moments in optimization. Cheers! Ben Root On Sat, Aug 30, 2014 at 1:45 PM, Nathaniel Smith n...@pobox.com wrote: On

Re: [Numpy-discussion] inplace unary operations?

2014-08-30 Thread Nathaniel Smith
On Sat, Aug 30, 2014 at 7:39 PM, Benjamin Root ben.r...@ou.edu wrote: Random thoughts are the best kinds of thoughts! I didn't even know there was a np.negative() function! Me neither, I had to look it up :-) -n -- Nathaniel J. Smith Postdoctoral researcher - Informatics - University of