Re: [Numpy-discussion] Boolean arrays with nulls?

2019-04-18 Thread Stuart Reynolds
masked_array(data=[True, False, --], > mask=[False, False, True], >fill_value=True) > > On Thu, 18 Apr 2019 at 10:51, Stuart Reynolds > wrote: > > > > Thanks. I’m aware of bool arrays. > > I think the tricky part of what I’m looking for is NULLability and > int

Re: [Numpy-discussion] Boolean arrays with nulls?

2019-04-18 Thread Stuart Reynolds
float8 a thing? On Thu, Apr 18, 2019 at 9:46 AM Stefan van der Walt wrote: > Hi Stuart, > > On Thu, 18 Apr 2019 09:12:31 -0700, Stuart Reynolds wrote: > > Is there an efficient way to represent bool arrays with null entries? > > You can use the bool dtype: > > In [5]

[Numpy-discussion] Boolean arrays with nulls?

2019-04-18 Thread Stuart Reynolds
Is there an efficient way to represent bool arrays with null entries? Tools like pandas push you very hard into 64 bit float representations - 64 bits where 3 will suffice is neither efficient for memory, nor (consequently), speed. What I’m hoping for is that there’s a structure that is ‘viewed’

[Numpy-discussion] numba: maps, and list of vectors

2019-01-17 Thread Stuart Reynolds
I'm having great luck using with numba, but there are two problems I find difficult to solve with it. Often I want to algorithms that performs a lookup of a list/array of numbers. And this operation often comes in two flavors: (1)=> # datastructure.get(0) => array (2)=> #

Re: [Numpy-discussion] py3k.os_fspath enforces inconsist rules with python3 os.fspath

2019-01-15 Thread Stuart Reynolds
Was recently already submitted: https://github.com/numpy/numpy/issues/12749 On Tue, Jan 15, 2019 at 8:08 AM Stuart Reynolds wrote: > Will do. > > On Mon, Jan 14, 2019 at 7:10 PM Eric Wieser > wrote: > >> This looks like a bug to me - can you file it on the issue tracker.

Re: [Numpy-discussion] py3k.os_fspath enforces inconsist rules with python3 os.fspath

2019-01-15 Thread Stuart Reynolds
Will do. On Mon, Jan 14, 2019 at 7:10 PM Eric Wieser wrote: > This looks like a bug to me - can you file it on the issue tracker. > > Evidently I did not consider python 2 behavior when backporting > `os.fspath` from python 3. > > Eric > > On Mon, 14 Jan 2019 at 16:28

[Numpy-discussion] py3k.os_fspath enforces inconsist rules with python3 os.fspath

2019-01-14 Thread Stuart Reynolds
After a recent upgrade of numpy (1.13.1 -> 1.6.0), my code is failing where I provide unicode objects as filenames. Previously they were allowed. Now that are not, and I *must* provide a (py2) str or bytearray only. # str is OK $ python2.7 -c "from numpy.compat import py3k; print py3k.os_fspath('1

Re: [Numpy-discussion] Casting scalars

2018-05-10 Thread Stuart Reynolds
np.float(scalar) On Thu, May 10, 2018 at 7:49 PM Hameer Abbasi wrote: > Hello, everyone! > > I might be missing something and this might be a very stupid and redundant > question, but is there a way to cast a scalar to a given dtype? > > Hameer > > > _

Re: [Numpy-discussion] best way of speeding up a filtering-like algorithm

2018-03-29 Thread Stuart Reynolds
Install snakeviz to visualize what’s taking all the time. You might want to check out numba.jit(nopython) for optimizing specific sections. On Wed, Mar 28, 2018 at 9:10 PM Joseph Fox-Rabinovitz < jfoxrabinov...@gmail.com> wrote: > It looks like you are creating a coastline mask (or a coastline