class_docstr: A uniform accessor that wraps data/schemas of varying formats with a
  common :func:`marshal` function.
code: def __init__(self, data_or_schema):
      (
          self._is_numpy,
          self._format,
          self._names,
          self._data_or_schema,
      ) = _type_to_format(data_or_schema)
      self._date_validator = _PerspectiveDateValidator()
      self._row_count = (
          len(self._data_or_schema)
          if self._format == 0
          else len(max(self._data_or_schema.values(), key=len))
          if self._format == 1
          else 0
      )
  
      self._types = []
  
      # Verify that column names are strings, and that numpy arrays are of
      # type `ndarray`
      for name in self._names:
          if not isinstance(name, str):
              raise PerspectiveError(
                  "Column names should be strings, not type `{0}`".format(
                      type(name).__name__
                  )
              )
          if self._is_numpy:
              array = self._data_or_schema[name]
  
              if not isinstance(array, numpy.ndarray):
                  raise PerspectiveError(
                      "Mixed datasets of numpy.ndarray and lists are not supported."
                  )
  
              dtype = array.dtype
  
              if (
                  name == "index"
                  and hasattr(data_or_schema, "index")
                  and isinstance(
                      data_or_schema.index, pandas.DatetimeIndex
                  )
              ):
                  # use the index of the original, unflattened dataframe
                  dtype = _parse_datetime_index(data_or_schema.index)
  
              # keep a string representation of the dtype, as PyBind only has
              # access to the char dtype code
              self._types.append(str(dtype))
  
      # When numpy arrays are cast from float to int, NaNs are lost. Use this
      # map to store the pre-cast masks, as we know the indices of NaNs do
      # not change when we cast from float to int.
      self._numpy_column_masks = {}
  
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 1 to create a new _PerspectiveAccessor object from inherited base classes: object with example: obj = _PerspectiveAccessor(data_or_schema)