parameters: (self, before=None, after=None)
return_statement: return MultiIndex(levels=new_levels, codes=new_codes, verify_integrity=False)
docstring: Slice index between two labels / tuples, return new MultiIndex
  
          Parameters
          ----------
          before : label or tuple, can be partial. Default None
              None defaults to start
          after : label or tuple, can be partial. Default None
              None defaults to end
  
          Returns
          -------
          truncated : MultiIndex
docstring_summary: Slice index between two labels / tuples, return new MultiIndex
docstring_tokens: Slice index between two labels / tuples return new MultiIndex
function: def truncate(self, before=None, after=None):
          """
          Slice index between two labels / tuples, return new MultiIndex
  
          Parameters
          ----------
          before : label or tuple, can be partial. Default None
              None defaults to start
          after : label or tuple, can be partial. Default None
              None defaults to end
  
          Returns
          -------
          truncated : MultiIndex
          """
          if after and before and after < before:
              raise ValueError("after < before")
  
          i, j = self.levels[0].slice_locs(before, after)
          left, right = self.slice_locs(before, after)
  
          new_levels = list(self.levels)
          new_levels[0] = new_levels[0][i:j]
  
          new_codes = [level_codes[left:right] for level_codes in self.codes]
          new_codes[0] = new_codes[0] - i
  
          return MultiIndex(levels=new_levels, codes=new_codes, verify_integrity=False)
function_tokens: def truncate ( self , before = None , after = None ) : if after and before and after < before : raise ValueError ( "after < before" ) i , j = self . levels [ 0 ] . slice_locs ( before , after ) left , right = self . slice_locs ( before , after ) new_levels = list ( self . levels ) new_levels [ 0 ] = new_levels [ 0 ] [ i : j ] new_codes = [ level_codes [ left : right ] for level_codes in self . codes ] new_codes [ 0 ] = new_codes [ 0 ] - i return MultiIndex ( levels = new_levels , codes = new_codes , verify_integrity = False )