def _convert_listlike(arg, unit='ns', box=True, errors='raise', name=None):
 if (isinstance(arg, (list, tuple)) or (not hasattr(arg, 'dtype'))):
  arg = np.array(list(arg), dtype='O')
 if is_timedelta64_dtype(arg):
  value = arg.astype('timedelta64[ns]')
 elif is_integer_dtype(arg):
  value = arg.astype('timedelta64[{0}]'.format(unit)).astype('timedelta64[ns]', copy=False)
 else:
  try:
   value = tslib.array_to_timedelta64(_ensure_object(arg), unit=unit, errors=errors)
   value = value.astype('timedelta64[ns]', copy=False)
  except ValueError:
   if (errors == 'ignore'):
    return arg
   else:
    raise
 if box:
  from pandas import TimedeltaIndex
  value = TimedeltaIndex(value, unit='ns', name=name)
 return value

def _convert_listlike ( arg , unit = 'ns' , box = True , errors = 'raise' , name = None ) : if ( isinstance ( arg , ( list , tuple ) ) or ( not hasattr ( arg , 'dtype' ) ) ) : arg = np . array ( list ( arg ) , dtype = 'O' ) if is_timedelta64_dtype ( arg ) : value = arg . astype ( 'timedelta64[ns]' ) elif is_integer_dtype ( arg ) : value = arg . astype ( 'timedelta64[{0}]' . format ( unit ) ) . astype ( 'timedelta64[ns]' , copy = False ) else : try : value = tslib . array_to_timedelta64 ( _ensure_object ( arg ) , unit = unit , errors = errors ) value = value . astype ( 'timedelta64[ns]' , copy = False ) except ValueError : if ( errors == 'ignore' ) : return arg else : raise if box : from pandas import TimedeltaIndex value = TimedeltaIndex ( value , unit = 'ns' , name = name ) return value
convert a list of objects to a timedelta index object .