parameters: (method, name: str)
return_statement: return new_method
docstring: Boilerplate for pandas conventions in arithmetic and comparison methods.
  
      Ensure method returns NotImplemented when operating against "senior"
      classes.  Ensure zero-dimensional ndarrays are always unpacked.
  
      Parameters
      ----------
      method : binary method
      name : str
  
      Returns
      -------
      method
docstring_summary: Boilerplate for pandas conventions in arithmetic and comparison methods.
docstring_tokens: Boilerplate for pandas conventions in arithmetic and comparison methods .
function: def _unpack_zerodim_and_defer(method, name: str):
      """
      Boilerplate for pandas conventions in arithmetic and comparison methods.
  
      Ensure method returns NotImplemented when operating against "senior"
      classes.  Ensure zero-dimensional ndarrays are always unpacked.
  
      Parameters
      ----------
      method : binary method
      name : str
  
      Returns
      -------
      method
      """
  
      is_cmp = name.strip("__") in {"eq", "ne", "lt", "le", "gt", "ge"}
  
      @wraps(method)
      def new_method(self, other):
  
          if is_cmp and isinstance(self, ABCIndexClass) and isinstance(other, ABCSeries):
              # For comparison ops, Index does *not* defer to Series
              pass
          else:
              for cls in [ABCDataFrame, ABCSeries, ABCIndexClass]:
                  if isinstance(self, cls):
                      break
                  if isinstance(other, cls):
                      return NotImplemented
  
          other = item_from_zerodim(other)
  
          return method(self, other)
  
      return new_method
function_tokens: def _unpack_zerodim_and_defer ( method , name : str ) : is_cmp = name . strip ( "__" ) in { "eq" , "ne" , "lt" , "le" , "gt" , "ge" } @ wraps ( method ) def new_method ( self , other ) : if is_cmp and isinstance ( self , ABCIndexClass ) and isinstance ( other , ABCSeries ) : # For comparison ops, Index does *not* defer to Series pass else : for cls in [ ABCDataFrame , ABCSeries , ABCIndexClass ] : if isinstance ( self , cls ) : break if isinstance ( other , cls ) : return NotImplemented other = item_from_zerodim ( other ) return method ( self , other ) return new_method