code: def test_pandas_label(
      self, data_split_mode: DataSplitMode = DataSplitMode.ROW
  ) -> None:
      world_size = xgb.collective.get_world_size()
      # label must be a single column
      df = pd.DataFrame({"A": ["X", "Y", "Z"], "B": [1, 2, 3]})
      with pytest.raises(ValueError):
          xgb.data._transform_pandas_df(df, False, None, None, "label")
  
      # label must be supported dtype
      df = pd.DataFrame({"A": np.array(["a", "b", "c"], dtype=object)})
      with pytest.raises(ValueError):
          xgb.data._transform_pandas_df(df, False, None, None, "label")
  
      df = pd.DataFrame({"A": np.array([1, 2, 3], dtype=int)})
      result, _, _ = xgb.data._transform_pandas_df(
          df, False, None, None, "label"
      )
      np.testing.assert_array_equal(
          np.stack(result.columns, axis=1),
          np.array([[1.0], [2.0], [3.0]], dtype=float),
      )
      dm = xgb.DMatrix(
          np.random.randn(3, 2),
          label=df,
          data_split_mode=data_split_mode,
      )
      assert dm.num_row() == 3
      if data_split_mode == DataSplitMode.ROW:
          assert dm.num_col() == 2
      else:
          assert dm.num_col() == 2 * world_size
  
imports: from typing import Type
  import numpy
  import pytest
  import xgboost
  from xgboost import testing
  from xgboost.core import DataSplitMode
  from xgboost.testing.data import pd_arrow_dtypes, pd_dtypes, run_base_margin_info
label_desc: Use image node_id 6 for calling the TestPandas obj's underlying member method code with example usage: obj.test_pandas_label(data_split_mode) without return types