docstr: Safely cast the values to the given dtype.
  
  "safe" in this context means the casting is lossless.
docstr_tok: ["Safely","cast","the","values","to","the","given","dtype",".","``","safe","''","in","this","context","means","the","casting","is","lossless","."]
code: def _safe_cast(
      cls, values: np.ndarray, dtype: np.dtype, copy: bool
  ) -> np.ndarray:
      """
      Safely cast the values to the given dtype.
  
      "safe" in this context means the casting is lossless.
      """
      raise AbstractMethodError(cls)
  
imports: from __future__ import annotations
  import numbers
  from typing import TYPE_CHECKING, Any, Callable, Mapping, TypeVar
  import numpy
  from pandas._libs import lib, missing
  from pandas._typing import Dtype, DtypeObj, npt
  from pandas.errors import AbstractMethodError
  from pandas.util._decorators import cache_readonly
  from pandas.core.dtypes.common import is_bool_dtype, is_float_dtype, is_integer_dtype, is_object_dtype, is_string_dtype, pandas_dtype
  from pandas.core.arrays.masked import BaseMaskedArray, BaseMaskedDtype
label_desc: Use image node_id 8 for calling the NumericDtype obj's underlying member method code with example usage: obj._safe_cast(cls, values, dtype, copy) without return types