Re: [Numpy-discussion] isnan() equivalent for np.NaT?

2016-07-18 Thread Gerrit Holl
On 18 July 2016 at 22:20, Scott Sanderson wrote: > I'm working on upgrading Zipline (github.com/quantopian/zipline) to the > latest numpy, and I'm getting a FutureWarnings about the upcoming change in > the behavior of comparisons on np.NaT. I'd like to be able to do checks for > NaT in a way tha

[Numpy-discussion] Should dtypes have an ndim attribute?

2015-12-10 Thread Gerrit Holl
Hi, I have made a modest proposal in issue #6752 . Basically, the proposal is to add an `ndim` attribute to dtypes. Currently, arrays have a shape and an ndim attribute, where ndim equals len(shape). dtype objects have a shape attribute, but no corres

[Numpy-discussion] Indexing structured masked arrays with multidimensional fields; what with fill_value?

2015-12-01 Thread Gerrit Holl
Hello, usually, a masked array's .fill_value attribute has ndim=0 and the same dtype as the data attribute: In [27]: ar = array((0, [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0]], 0.0), dtype="int, (2,3)float, float") In [28]: arm = ma.masked_array(ar) In [29]: arm.fill_value.ndim Out[29]: 0 In [31]: arm.

[Numpy-discussion] subdivide array

2010-11-30 Thread Gerrit Holl
fully land... BTW, I just realised Pythons convention that negative indices count from the end of the array is perfect when using a 180x360 land-sea-mask, as lon[-30] and lon[330] mean and should mean the same :) Gerrit. -- Gerrit Holl PhD student at Department of Space Science, L

Re: [Numpy-discussion] merge_arrays is very slow; alternatives?

2010-11-26 Thread Gerrit Holl
On 26 November 2010 20:16, Gerrit Holl wrote: > Hi, > > upon profiling my code, I found that > numpy.lib.recfunctions.merge_arrays is extremely slow; it does some > 7000 rows/second. This is not acceptable for me. ... > How can I do this in a faster way? Replying to my own c

[Numpy-discussion] merge_arrays is very slow; alternatives?

2010-11-26 Thread Gerrit Holl
0.000    0.000    0.000 {numpy.core.multiarray.array}        1   10.142   10.142   10.142   10.142 {numpy.core.multiarray.fromiter} Gerrit. -- Gerrit Holl PhD student at Department of Space Science, Luleå University of Technology, Kiruna, Sweden http://www.sat.ltu.se/members/gerrit/ _

Re: [Numpy-discussion] numpy.test() errors

2010-11-23 Thread Gerrit Holl
2010/11/23 Stéfan van der Walt : > On Tue, Nov 23, 2010 at 9:28 AM, Nils Wagner > wrote: >> "/data/home/nwagner/local/lib/python2.5/site-packages/numpy/lib/npyio.py", >> line 66, in seek_gzip_factory >>     g.name = f.name >> AttributeError: GzipFile instance has no attribute 'name' > > This one i

Re: [Numpy-discussion] Advise for numerical programming content (New python user)

2010-11-19 Thread Gerrit Holl
Hi, On 19 November 2010 03:48, Sachin Kumar Sharma wrote: > Does graphic output like maps, histogram, crossplot, tornado charts is good > enough with basic installation or needs some additional packages? You might want to ask this question at the scipy mailig-list. For maps, you need basemap or

Re: [Numpy-discussion] Printing formatted numerical values

2010-11-15 Thread Gerrit Holl
On 15 November 2010 15:32, wrote: > Hi, what is the best way to print (to a file or to stdout) formatted > numerical values? Analogously to C's printf("%d %g",x,y) etc? Use the .tofile() method: numpy.random.random(5).tofile(sys.stdout, ' ', '%s') 0.230466435867 0.609443784908 0.353855676828 0.

Re: [Numpy-discussion] List with numpy semantics

2010-10-31 Thread Gerrit Holl
On 31 October 2010 17:10, Nikolaus Rath wrote: > Hello, > > I have a couple of numpy arrays which belong together. Unfortunately > they have different dimensions, so I can't bundle them into a higher > dimensional array. > > My solution was to put them into a Python list instead. But > unfortunate