code: def _convert_bin_to_numeric_type(bins, dtype):
      
      bins_dtype = infer_dtype(bins, skipna=False)
      if is_timedelta64_dtype(dtype):
          if bins_dtype in ['timedelta', 'timedelta64']:
              bins = to_timedelta(bins).view(np.int64)
          else:
              raise ValueError("bins must be of timedelta64 dtype")
      elif is_datetime64_dtype(dtype) or is_datetime64tz_dtype(dtype):
          if bins_dtype in ['datetime', 'datetime64']:
              bins = to_datetime(bins).view(np.int64)
          else:
              raise ValueError("bins must be of datetime64 dtype")
  
      return bins
docs: 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