@@ -454,41 +454,39 @@ def all(self, name=None):
454454 raise NotImplementedError ('Axis.all is deprecated. Use {}[:] >> {} instead.'
455455 .format (axis_name , repr (group_name )))
456456
457- # TODO: make this method private and drop name argument (it is never used)
458- def subaxis (self , key , name = None ):
457+ # TODO: make this method private
458+ def subaxis (self , key ):
459459 r"""
460460 Returns an axis for a sub-array.
461461
462462 Parameters
463463 ----------
464464 key : int, or collection (list, slice, array, Array) of them
465- Indices of labels to use for the new axis.
466- name : str, optional
467- Name of the subaxis. Defaults to the name of the parent axis.
465+ Indices-based key to use for the new axis.
468466
469467 Returns
470468 -------
471469 Axis
472- Subaxis. If key is a None slice and name is None , the original Axis is returned.
470+ Subaxis. If key is a None slice, the original Axis is returned.
473471 If key is an Array, the list of axes is returned.
474472
475473 Examples
476474 --------
477475 >>> age = Axis(range(100), 'age')
478- >>> age.subaxis(range(10, 19), 'teenagers' )
479- Axis([10, 11, 12, 13, 14, 15, 16, 17, 18], 'teenagers ')
476+ >>> age.subaxis(range(10, 19))
477+ Axis([10, 11, 12, 13, 14, 15, 16, 17, 18], 'age ')
480478 """
481- if name is None and isinstance (key , slice ) and key .start is None and key .stop is None and key .step is None :
479+ if isinstance (key , slice ) and key .start is None and key .stop is None and key .step is None :
482480 return self
483- # we must NOT modify the axis name, even though this creates a new axis that is independent from the original
484- # one because the original name is probably what users will want to use to filter
485- if name is None :
486- name = self .name
487481 if isinstance (key , ABCArray ):
488482 return key .axes
483+
489484 # TODO: compute length for wildcard axes more efficiently
490485 labels = len (self .labels [key ]) if self .iswildcard else self .labels [key ]
491- return Axis (labels , name )
486+
487+ # we must NOT modify the axis name, even though this creates a new axis that is independent from the original
488+ # one because the original name is probably what users will want to use to filter
489+ return Axis (labels , self .name )
492490
493491 def iscompatible (self , other ):
494492 r"""
0 commit comments