docs: def datetime_to_numeric(array, offset=None, datetime_unit=None, dtype=float):
      """Convert an array containing datetime-like data to an array of floats.
  
      Parameters
      ----------
      da : np.array
          Input data
      offset: Scalar with the same type of array or None
          If None, subtract minimum values to reduce round off error
      datetime_unit: None or any of {'Y', 'M', 'W', 'D', 'h', 'm', 's', 'ms',
          'us', 'ns', 'ps', 'fs', 'as'}
      dtype: target dtype
  
      Returns
      -------
      array
      """
      # TODO: make this function dask-compatible?
      if offset is None:
          offset = array.min()
      array = array - offset
  
      if not hasattr(array, 'dtype'):  # scalar is converted to 0d-array
          array = np.array(array)
  
      if array.dtype.kind in 'O':
          # possibly convert object array containing datetime.timedelta
          array = np.asarray(pd.Series(array.ravel())).reshape(array.shape)
  
      if datetime_unit:
          array = array / np.timedelta64(1, datetime_unit)
  
      # convert np.NaT to np.nan
      if array.dtype.kind in 'mM':
          return np.where(isnull(array), np.nan, array.astype(dtype))
      return array.astype(dtype)