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

2019-04-22 Thread Chris Barker
On Thu, Apr 18, 2019 at 10:52 AM Stuart Reynolds wrote: > Is float8 a thing? > no, but np.float16 is -- so at least only twice as much memory as youo need :-) array([ nan, inf, -inf], dtype=float16) I think masked arrays are going to be just as much, as they need to carry the mask. -CHB >

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

2019-04-18 Thread Stuart Reynolds
Looks like a good fit. Thanks. On Thu, Apr 18, 2019 at 11:17 AM Eric Wieser wrote: > One option here would be to use masked arrays: > > arr = np.ma.zeros(3, dtype=bool) > arr[0] = True > arr[1] = False > arr[2] = np.ma.masked > > giving > > masked_array(data=[True, False, --], > mas

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

2019-04-18 Thread Eric Wieser
One option here would be to use masked arrays: arr = np.ma.zeros(3, dtype=bool) arr[0] = True arr[1] = False arr[2] = np.ma.masked giving masked_array(data=[True, False, --], mask=[False, False, True], fill_value=True) On Thu, 18 Apr 2019 at 10:51, Stuart Reynolds wrote: >

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

2019-04-18 Thread Stuart Reynolds
Thanks. I’m aware of bool arrays. I think the tricky part of what I’m looking for is NULLability and interoperability with code the deals with billable data (float arrays). Currently the options seem to be float arrays, or custom operations that carry (unabstracted) categorical array data represen

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

2019-04-18 Thread Stefan van der Walt
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]: x = np.array([True, False, True])

[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’