code: def can_cast_dtype(values, dtype):
      """Test if values can be cast to dtype without loss of information.
  
      Parameters
      ----------
      values: list-like
      dtype: numpy.dtype or string
  
      Returns
      -------
      boolean
          True if values can be cast to data type.
      """
      values = numpy.asanyarray(values)
  
      if values.dtype.name == _getnpdtype(dtype).name:
          return True
  
      elif values.dtype.kind == "f":
          return numpy.allclose(
              values, values.astype(dtype), equal_nan=True
          )
  
      else:
          return numpy.array_equal(values, values.astype(dtype))
  
file_path: rasterio/rasterio/dtypes.py
imports: import numpy
  from rasterio.env import GDALVersion
label_desc: Use image node_id 7 for calling a global function with example usage: can_cast_dtype(values, dtype) and returns: True, numpy, numpy