code: def test_index_initializer(setup):
      # from tensor
      raw = np.arange(100)
      np.random.shuffle(raw)
      tensor = mt.tensor(raw)
      r = md.Index(tensor, chunk_size=7)
      result = r.execute().fetch()
      pd.testing.assert_index_equal(result, pd.Index(raw))
  
      # from Mars index
      raw = np.arange(100)
      np.random.shuffle(raw)
      idx = md.Index(raw, chunk_size=7)
      r = md.Index(idx, num_partitions=11)
      result = r.execute().fetch()
      pd.testing.assert_index_equal(result, pd.Index(raw))
  
      # from pandas initializer
      raw = np.arange(100)
      np.random.shuffle(raw)
      raw_ser = pd.Series(raw, name="series_name")
      r = md.Index(raw_ser, chunk_size=7)
      result = r.execute().fetch()
      pd.testing.assert_index_equal(result, pd.Index(raw_ser))
  
      raw_idx = pd.Index(raw, name="idx_name")
      r = md.Index(raw_idx, num_partitions=10)
      result = r.execute().fetch()
      pd.testing.assert_index_equal(result, pd.Index(raw_idx))
  
file_path: mars/mars/dataframe/tests/test_initializer.py
imports: import numpy
  import pandas
  from ...None import dataframe
  from ...None import tensor
  from ...tests.core import require_cudf, require_cupy
  from ...utils import lazy_import
label_desc: Use image node_id 5 for calling a global function with example usage: test_index_initializer(setup) without return types