2009/7/29 Ernest Adrogué <[email protected]>:
> 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?

Not really. Use masked arrays. Or use a dictionary.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to