code: def test_cv(self):
      dm = xgb.DMatrix(dpath + "agaricus.txt.train")
      params = {
          "max_depth": 2,
          "eta": 1,
          "silent": 1,
          "objective": "binary:logistic",
      }
  
      import pandas as pd
  
      cv = xgb.cv(params, dm, num_boost_round=10, nfold=10)
      assert isinstance(cv, pd.DataFrame)
      exp = pd.Index(
          [
              "test-error-mean",
              "test-error-std",
              "train-error-mean",
              "train-error-std",
          ]
      )
      assert cv.columns.equals(exp)
  
      # show progress log (result is the same as above)
      cv = xgb.cv(
          params, dm, num_boost_round=10, nfold=10, show_progress=True
      )
      assert isinstance(cv, pd.DataFrame)
      exp = pd.Index(
          [
              "test-error-mean",
              "test-error-std",
              "train-error-mean",
              "train-error-std",
          ]
      )
      assert cv.columns.equals(exp)
      cv = xgb.cv(
          params,
          dm,
          num_boost_round=10,
          nfold=10,
          show_progress=True,
          show_stdv=False,
      )
      assert isinstance(cv, pd.DataFrame)
      exp = pd.Index(
          [
              "test-error-mean",
              "test-error-std",
              "train-error-mean",
              "train-error-std",
          ]
      )
      assert cv.columns.equals(exp)
  
      # return np.ndarray
      cv = xgb.cv(
          params, dm, num_boost_round=10, nfold=10, as_pandas=False
      )
      assert isinstance(cv, np.ndarray)
      assert cv.shape == (10, 4)
  
file_path: turicreate/src/external/xgboost/tests/python/test_basic.py
imports: import numpy
  import xgboost
  import unittest
  import matplotlib
label_desc: Use image node_id 7 for calling the TestBasic obj's underlying member method code with example usage: obj.test_cv() without return types