class_docstr: A Column object for Numeric types.
  
  Parameters
  ----------
  data : Buffer
  dtype : np.dtype
      The dtype associated with the data Buffer
  mask : Buffer, optional
class_docstr_tok: ["A","Column","object","for","Numeric","types",".","Parameters","--","--","--","--","--","data",":","Buffer","dtype",":","np.dtype","The","dtype","associated","with","the","data","Buffer","mask",":","Buffer",",","optional"]
docstr: Returns true if all the values in self can be
  safely cast to dtype
docstr_tok: ["Returns","true","if","all","the","values","in","self","can","be","safely","cast","to","dtype"]
code: def can_cast_safely(self, to_dtype: DtypeObj) -> bool:
      """
      Returns true if all the values in self can be
      safely cast to dtype
      """
      if self.dtype.kind == to_dtype.kind:
          if self.dtype <= to_dtype:
              return True
          else:
              # Kinds are the same but to_dtype is smaller
              if "float" in to_dtype.name:
                  finfo = np.finfo(to_dtype)
                  lower_, upper_ = finfo.min, finfo.max
              elif "int" in to_dtype.name:
                  iinfo = np.iinfo(to_dtype)
                  lower_, upper_ = iinfo.min, iinfo.max
  
              if self.dtype.kind == "f":
                  # Exclude 'np.inf', '-np.inf'
                  s = cudf.Series(self)
                  # TODO: replace np.inf with cudf scalar when
                  # https://github.com/rapidsai/cudf/pull/6297 merges
                  non_infs = s[~((s == np.inf) | (s == -np.inf))]
                  col = non_infs._column
              else:
                  col = self
  
              min_ = col.min()
              # TODO: depending on implementation of cudf scalar and future
              # refactor of min/max, change the test method
              if np.isnan(min_):
                  # Column contains only infs
                  return True
  
              return (min_ >= lower_) and (col.max() < upper_)
  
      # want to cast int to uint
      elif self.dtype.kind == "i" and to_dtype.kind == "u":
          i_max_ = np.iinfo(self.dtype).max
          u_max_ = np.iinfo(to_dtype).max
  
          return (self.min() >= 0) and (
              (i_max_ <= u_max_) or (self.max() < u_max_)
          )
  
      # want to cast uint to int
      elif self.dtype.kind == "u" and to_dtype.kind == "i":
          u_max_ = np.iinfo(self.dtype).max
          i_max_ = np.iinfo(to_dtype).max
  
          return (u_max_ <= i_max_) or (self.max() < i_max_)
  
      # want to cast int to float
      elif self.dtype.kind in {"i", "u"} and to_dtype.kind == "f":
          info = np.finfo(to_dtype)
          biggest_exact_int = 2 ** (info.nmant + 1)
          if (self.min() >= -biggest_exact_int) and (
              self.max() <= biggest_exact_int
          ):
              return True
          else:
              filled = self.fillna(0)
              return (
                  cudf.Series(filled)
                  .astype(to_dtype)
                  .astype(filled.dtype)
                  == cudf.Series(filled)
              ).all()
  
      # want to cast float to int:
      elif self.dtype.kind == "f" and to_dtype.kind in {"i", "u"}:
          if self.nan_count > 0:
              return False
          iinfo = np.iinfo(to_dtype)
          min_, max_ = iinfo.min, iinfo.max
  
          # best we can do is hope to catch it here and avoid compare
          if (self.min() >= min_) and (self.max() <= max_):
              filled = self.fillna(0)
              return (cudf.Series(filled) % 1 == 0).all()
          else:
              return False
  
      return False
  
imports: from __future__ import annotations
  from typing import Any, Callable, Mapping, Optional, Sequence, Tuple, Union, cast
  import cupy
  import numpy
  import pandas
  from typing_extensions import Self
  import cudf
  from cudf import _lib
  from cudf._lib.types import size_type_dtype
  from cudf._typing import ColumnBinaryOperand, ColumnLike, Dtype, DtypeObj, ScalarLike
  from cudf.api.types import is_bool_dtype, is_float_dtype, is_integer, is_integer_dtype, is_scalar
  from cudf.core.buffer import Buffer, cuda_array_interface_wrapper
  from cudf.core.column import ColumnBase, as_column, build_column, column, full, string
  from cudf.core.dtypes import CategoricalDtype
  from cudf.core.mixins import BinaryOperand
  from cudf.utils.dtypes import NUMERIC_TYPES, min_column_type, min_signed_type, np_dtypes_to_pandas_dtypes, numeric_normalize_types
  from .numerical_base import NumericalBaseColumn
label_desc: Use image node_id 26 for calling the NumericalColumn obj's underlying member method code with example usage: obj.can_cast_safely(to_dtype) and returns: False, True, unknown, unknown, True, unknown, True, unknown, False, unknown, False