class_docstr: A data iterator for XGBoost DMatrix.
  
  `reset` and `next` are required for any data iterator, other functions here
  are utilites for demonstration's purpose.
docstr: Generate some random data for demostration.
  
  Actual data can be anything that is currently supported by XGBoost.
docstr_tok: ["Generate","some","random","data","for","demostration",".","Actual","data","can","be","anything","that","is","currently","supported","by","XGBoost","."]
code: def __init__(self, categorical):
      """Generate some random data for demostration.
  
      Actual data can be anything that is currently supported by XGBoost.
      """
      self.rows = self.ROWS_PER_BATCH
  
      if categorical:
          self._data = []
          self._labels = []
          for i in range(self.BATCHES):
              X, y = tm.make_categorical(
                  self.ROWS_PER_BATCH, 4, 13, False
              )
              self._data.append(cudf.from_pandas(X))
              self._labels.append(y)
      else:
          rng = np.random.RandomState(1994)
          self._data = [
              cudf.DataFrame(
                  {
                      "a": rng.randn(self.ROWS_PER_BATCH),
                      "b": rng.randn(self.ROWS_PER_BATCH),
                  }
              )
          ] * self.BATCHES
          self._labels = [rng.randn(self.rows)] * self.BATCHES
  
      self.it = 0  # set iterator to 0
      super().__init__(cache_prefix=None)
  
imports: import json
  import numpy
  import pytest
  import xgboost
  from xgboost import testing
  from xgboost.testing.data import run_base_margin_info
label_desc: Use image node_id 1 to create a new IterForDMatrixTest object from inherited base classes: xgb.core with example: obj = IterForDMatrixTest(categorical)