def _coerce_method(converter):
 def wrapper(self):
  if (len(self) == 1):
   return converter(self.iloc[0])
  raise TypeError('cannot convert the series to {0}'.format(str(converter)))
 return wrapper

def _coerce_method ( converter ) : def wrapper ( self ) : if ( len ( self ) == 1 ) : return converter ( self . iloc [ 0 ] ) raise TypeError ( 'cannot convert the series to {0}' . format ( str ( converter ) ) ) return wrapper
install the scalar coercion methods .