class_docstr: A subclass of ndarray that lets you give names to indices.
  
  This is a normal ndarray in the sense that you can always index by numbers and
  slices, though elipses don't work. Also, all elements have the same type,
  unlike a record array.
  
  Names should be a list of names per dimension in the ndarray shape. The names
  should be a list or tuple of strings, a namedtuple class (with names taken
  from _fields), or an IntEnum. Alternatively if you don't want to give a name
  to a particular dimension, use None. If your array only has one dimension, the
  second level of list can be skipped.
  
  Example usage:
    a = named_array.NamedNumpyArray([1, 3, 6], ["a", "b", "c"])
    a.a, a[1], a["c"] => 1, 3, 6
    b = named_array.NamedNumpyArray([[1, 3], [6, 8]], [["a", "b"], None])
    b.a, b[1], b["a", 1] => [1, 3], [6, 8], 3
    c = named_array.NamedNumpyArray([[1, 3], [6, 8]], [None, ["a", "b"]])
    c[0].a, b[1, 0], b[1, "b"] => 1, 6, 8
  Look at the tests for more examples including using enums and named tuples.
docstr: Turn a string into a real index, otherwise return the index.
docstr_tok: ["Turn","a","string","into","a","real","index",",","otherwise","return","the","index","."]
code: def _get_index(self, dim, index):
      """Turn a string into a real index, otherwise return the index."""
      if isinstance(index, str):
          try:
              return self._index_names[dim][index]
          except KeyError:
              raise KeyError(
                  "Name '%s' is invalid for axis %s." % (index, dim)
              )
          except TypeError:
              raise TypeError(
                  "Trying to access an unnamed axis %s by name: '%s'"
                  % (dim, index)
              )
      else:
          return index
  
imports: import enum
  import numbers
  import re
  import numpy
label_desc: Use image node_id 13 for calling the NamedNumpyArray obj's underlying member method code with example usage: obj._get_index(dim, index) and returns: index, self