def _coerce_scalar_to_timedelta_type(r, unit='ns', box=True, errors='raise'):
 try:
  result = tslib.convert_to_timedelta64(r, unit)
 except ValueError:
  if (errors == 'raise'):
   raise
  elif (errors == 'ignore'):
   return r
  result = pd.NaT
 if box:
  result = tslib.Timedelta(result)
 return result

def _coerce_scalar_to_timedelta_type ( r , unit = 'ns' , box = True , errors = 'raise' ) : try : result = tslib . convert_to_timedelta64 ( r , unit ) except ValueError : if ( errors == 'raise' ) : raise elif ( errors == 'ignore' ) : return r result = pd . NaT if box : result = tslib . Timedelta ( result ) return result
convert string r to a timedelta object .