[Numpy-discussion] question about a data structure

Ernest Adrogué eadrogue at gmx.net
Wed Jul 29 17:36:39 EDT 2009


Hello,

Suppose I want to store some data (a non-negative integer)
related to an "event" involving two entities. It occurs to me that
the way to do it is using a 2-d array, like a table:

For example:

  a  b  c
a    1
b 2     0
c 5      

in the event 'b-a' the data is 2, and in the event 'c-a' is 5, etc.

Now, I need to be able to differentiate between 0 and 'no data'.
I know I could use a number like -1, but this would affect arithmetic
operations on the array, and also I need that indexing one such
location with no data returns an empty array.

Is it possible to do this with the standard array class?

Thanks.

Ernest




More information about the NumPy-Discussion mailing list