class_docstr: A uniform accessor that wraps data/schemas of varying formats with a
  common :func:`marshal` function.
docstr: When a numpy dataset is used to update, and when self._types
  contains t_dtype objects from Perspective's already-initialized table,
  use perspective dtypes and numpy dtypes to cast trivially comparable
  dtypes to avoid iterative fills in C++.
docstr_tok: ["When","a","numpy","dataset","is","used","to","update",",","and","when","self._types","contains","t_dtype","objects","from","Perspective","'s","already-initialized","table",",","use","perspective","dtypes","and","numpy","dtypes","to","cast","trivially","comparable","dtypes","to","avoid","iterative","fills","in","C++","."]
code: def try_cast_numpy_arrays(self):
      """When a numpy dataset is used to update, and when self._types
      contains t_dtype objects from Perspective's already-initialized table,
      use perspective dtypes and numpy dtypes to cast trivially comparable
      dtypes to avoid iterative fills in C++.
      """
      for i in range(len(self._names)):
          name = self._names[i]
  
          if name == "__INDEX__":
              # Don't try to coerce implicit index column
              continue
  
          array = self._data_or_schema.get(name, None)
  
          if array is None:
              continue
  
          type = self._types[i]
  
          if (
              array.dtype == numpy.float64
              and type == t_dtype.DTYPE_INT64
          ):
              # masking will take care of the `nan`/None values in the array
              # when the conversion to int64 garbles them
              mask = make_null_mask(array)
              self._numpy_column_masks[name] = mask
              self._data_or_schema[name] = numpy.int64(array)
          elif (
              array.dtype == numpy.int64
              and type == t_dtype.DTYPE_FLOAT64
          ):
              # there cannot be `nan` values in int64
              self._data_or_schema[name] = array.astype(numpy.float64)
          elif (
              array.dtype == numpy.float32
              and type == t_dtype.DTYPE_FLOAT64
          ):
              mask = make_null_mask(array)
              self._numpy_column_masks[name] = mask
              self._data_or_schema[name] = numpy.float64(array)
          elif (
              array.dtype == numpy.float32
              and type == t_dtype.DTYPE_FLOAT32
          ):
              mask = make_null_mask(array)
              self._numpy_column_masks[name] = mask
              self._data_or_schema[name] = numpy.float32(array)
  
imports: from distutils.util import strtobool
  from math import isnan
  import numpy
  import pandas
  from ..core.data import deconstruct_numpy, deconstruct_pandas, make_null_mask
  from ..core.data.pd import _parse_datetime_index
  from ..core.exception import PerspectiveError
  from ._date_validator import _PerspectiveDateValidator
  from .libpsppy import t_dtype
label_desc: Use image node_id 10 for calling the _PerspectiveAccessor obj's underlying member method code with example usage: obj.try_cast_numpy_arrays() without return types