def _convert_bin_to_numeric_type(bins, dtype):
bins_dtype = infer_dtype(bins, skipna=False)<EOL>if is_timedelta64_dtype(dtype):<EOL><INDENT>if bins_dtype in ['<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>bins = to_timedelta(bins).view(np.int64)<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT>elif is_datetime64_dtype(dtype) or is_datetime64tz_dtype(dtype):<EOL><INDENT>if bins_dtype in ['<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>bins = to_datetime(bins).view(np.int64)<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT>return bins<EOL>
if the passed bin is of datetime/timedelta type,
this method converts it to integer

Parameters
----------
bins : list-like of bins
dtype : dtype of data

Raises
------
ValueError if bins are not of a compat dtype to dtype