def _coerce_scalar_to_timedelta_type(r, unit='ns', errors='raise'):
    "Convert string 'r' to a timedelta object."
    try:
        result = Timedelta(r, unit)
    except ValueError:
        if (errors == 'raise'):
            raise
        elif (errors == 'ignore'):
            return r
        result = NaT
    return result
Convert string 'r' to a timedelta object.
def _coerce_scalar_to_timedelta_type(r, unit='ns', errors='raise'):
    
    try:
        result = Timedelta(r, unit)
    except ValueError:
        if (errors == 'raise'):
            raise
        elif (errors == 'ignore'):
            return r
        result = NaT
    return result