@@ -454,41 +454,39 @@ def all(self, name=None):
454
454
raise NotImplementedError ('Axis.all is deprecated. Use {}[:] >> {} instead.'
455
455
.format (axis_name , repr (group_name )))
456
456
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 ):
459
459
r"""
460
460
Returns an axis for a sub-array.
461
461
462
462
Parameters
463
463
----------
464
464
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.
468
466
469
467
Returns
470
468
-------
471
469
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.
473
471
If key is an Array, the list of axes is returned.
474
472
475
473
Examples
476
474
--------
477
475
>>> 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 ')
480
478
"""
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 :
482
480
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
487
481
if isinstance (key , ABCArray ):
488
482
return key .axes
483
+
489
484
# TODO: compute length for wildcard axes more efficiently
490
485
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 )
492
490
493
491
def iscompatible (self , other ):
494
492
r"""
0 commit comments