code: def _axis_levels(self, axis):
          
          ax = self._axis(axis)
          return 1 if not hasattr(ax, 'levels') else len(ax.levels)
docs: Return the number of levels in the labels taking into account the axis.
  
          Get the number of levels for the columns (0) or rows (1).