[Numpy-discussion] Datarray BoF, part2
Wed Jul 21 11:56:05 CDT 2010
I don't really know much about this topic, but what about a flag at array
creation time (or whenever you define labels) that says whether valid
indexes will be treated as labels or indexes for that array?
On Wed, Jul 21, 2010 at 9:37 AM, Keith Goodman <email@example.com> wrote:
> About a dozen people attended what was billed as a continuation of the
> SciPy 2010 datarray BoF. We met at UC Berkeley on July 19 as part of
> the py4science series.
> A datarray is a subclass of a Numpy array that adds the ability to
> label the axes and to label the elements along each axis.
> We spent most of the time discussing how to index with tick labels.
> The main issue is with integers: is an integer index a tick name or a
> position index?
> At the top level, datarrays always use regular Numpy indexing: an int
> is a position, never a label. So darr always returns the first
> element of the datarray.
> The ambiguity occurs in specialized indexing methods that allow
> indexing by tick label name (because the name could be an int). To
> break the ambiguity, the proposal was to provide several tick indexing
> 1. Integers are always labels
> 2. Integers are never treated as labels
> 3. Try 1, then 2
> We also discussed allowing axis labels to be any hashable object
> (currently only strings are allowed). The main problem: integers.
> Currently if an axis is labeled, say, "time", you can do
> darr.sum(axis="time"). What happens when an axis is labeled with an
> int? What does the 2 in darr.sum(axis=2) refer to? A position or a
> label? The same problem exists for floats since a float is (currently)
> a valid axis for Numpy arrays.
> NumPy-Discussion mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion