class_docstr: View of statistics for a dataset (slice).
class_docstr_tok: ["View","of","statistics","for","a","dataset","(","slice",")","."]
docstr: Initializes internal indices. Noop if already initialized.
docstr_tok: ["Initializes","internal","indices",".","Noop","if","already","initialized","."]
code: def _init_index(self):
      """Initializes internal indices. Noop if already initialized."""
      if self._initialized:
          return
      field_identifier = None
      for j, feature in enumerate(self._statistics.features):
          if field_identifier is None:
              field_identifier = feature.WhichOneof("field_id")
          elif feature.WhichOneof("field_id") != field_identifier:
              raise ValueError(
                  "Features must be specified with either path or name within a"
                  " Dataset."
              )
  
          if field_identifier == "name":
              feature_id = types.FeaturePath([feature.name])
          else:
              feature_id = types.FeaturePath.from_proto(feature.path)
  
          if feature_id in self._feature_map:
              raise ValueError("Duplicate feature %s" % feature_id)
          self._feature_map[feature_id] = j
      for j, cross_feature in enumerate(
          self._statistics.cross_features
      ):
          feature_id = (
              types.FeaturePath.from_proto(cross_feature.path_x),
              types.FeaturePath.from_proto(cross_feature.path_y),
          )
          if feature_id in self._cross_feature_map:
              raise ValueError("Duplicate feature %s" % feature_id)
          self._cross_feature_map[feature_id] = j
      self._initialized = True
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import logging
  from typing import Dict, Iterable, Optional, Sequence, Text, Tuple, Union
  import numpy
  import pyarrow
  import tensorflow
  from tensorflow_data_validation import constants
  from tensorflow_data_validation import types
  from tensorflow_data_validation.arrow import arrow_util
  from tensorflow_data_validation.utils import artifacts_io_impl
  from tensorflow_data_validation.utils import io_util
  from tfx_bsl import statistics
  from tfx_bsl.arrow import array_util
  from google.protobuf import text_format
  from tensorflow_metadata.proto.v0 import statistics_pb2
label_desc: Use image node_id 2 for calling the DatasetView obj's underlying member method code with example usage: obj._init_index() without return types