code: def test_pandas_weight(self, data_split_mode=DataSplitMode.ROW):
      world_size = xgb.collective.get_world_size()
      kRows = 32
      kCols = 8
  
      X = np.random.randn(kRows, kCols)
      y = np.random.randn(kRows)
      w = np.random.uniform(size=kRows).astype(np.float32)
      w_pd = pd.DataFrame(w)
      data = xgb.DMatrix(
          X, y, weight=w_pd, data_split_mode=data_split_mode
      )
  
      assert data.num_row() == kRows
      if data_split_mode == DataSplitMode.ROW:
          assert data.num_col() == kCols
      else:
          assert data.num_col() == kCols * world_size
      np.testing.assert_array_equal(data.get_weight(), w)
  
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 7 for calling the TestPandas obj's underlying member method code with example usage: obj.test_pandas_weight(data_split_mode) without return types