def _ensure_datetimelike_to_i8(other):
 if (lib.isscalar(other) and isnull(other)):
  other = tslib.iNaT
 elif isinstance(other, ABCIndexClass):
  if (getattr(other, 'tz', None) is not None):
   other = other.tz_localize(None).asi8
  else:
   other = other.asi8
 else:
  try:
   other = np.array(other, copy=False).view('i8')
  except TypeError:
   other = Index(other).asi8
 return other

def _ensure_datetimelike_to_i8 ( other ) : if ( lib . isscalar ( other ) and isnull ( other ) ) : other = tslib . iNaT elif isinstance ( other , ABCIndexClass ) : if ( getattr ( other , 'tz' , None ) is not None ) : other = other . tz_localize ( None ) . asi8 else : other = other . asi8 else : try : other = np . array ( other , copy = False ) . view ( 'i8' ) except TypeError : other = Index ( other ) . asi8 return other
helper for coercing an input scalar or array to i8 .