code: def test_to_frame_or_series(setup):
      raw = pd.Series(np.random.rand(10), name="col")
      series = Series(raw)
  
      r = series.to_frame()
      result = r.execute().fetch()
      pd.testing.assert_frame_equal(raw.to_frame(), result)
  
      r = series.to_frame(name="new_name")
      result = r.execute().fetch()
      pd.testing.assert_frame_equal(
          raw.to_frame(name="new_name"), result
      )
  
      series = series[series > 0.1]
      r = series.to_frame(name="new_name")
      result = r.execute().fetch()
      pd.testing.assert_frame_equal(
          raw[raw > 0.1].to_frame(name="new_name"), result
      )
  
      raw = pd.Index(np.random.rand(10), name="col")
      index = Index(raw)
  
      r = index.to_frame()
      result = r.execute().fetch()
      pd.testing.assert_frame_equal(raw.to_frame(), result)
  
      r = index.to_frame(index=False)
      result = r.execute().fetch()
      pd.testing.assert_frame_equal(raw.to_frame(index=False), result)
  
      r = index.to_frame(name="new_name")
      result = r.execute().fetch()
      pd.testing.assert_frame_equal(
          raw.to_frame(name="new_name"), result
      )
  
      r = index.to_series()
      result = r.execute().fetch()
      pd.testing.assert_series_equal(raw.to_series(), result)
  
      r = index.to_series(index=pd.RangeIndex(0, 10))
      result = r.execute().fetch()
      pd.testing.assert_series_equal(
          raw.to_series(index=pd.RangeIndex(0, 10)), result
      )
  
      r = index.to_series(name="new_name")
      result = r.execute().fetch()
      pd.testing.assert_series_equal(
          raw.to_series(name="new_name"), result
      )
  
      raw = pd.MultiIndex.from_tuples(
          [("A", "E"), ("B", "F"), ("C", "G")]
      )
      index = Index(raw, tupleize_cols=True)
  
      r = index.to_frame()
      result = r.execute().fetch()
      pd.testing.assert_frame_equal(raw.to_frame(), result)
  
      with pytest.raises(TypeError):
          index.to_frame(name="XY")
  
      with pytest.raises(ValueError):
          index.to_frame(name=["X", "Y", "Z"])
  
      r = index.to_frame(name=["X", "Y"])
      result = r.execute().fetch()
      pd.testing.assert_frame_equal(
          raw.to_frame(name=["X", "Y"]), result
      )
  
      r = index.to_series(name="new_name")
      result = r.execute().fetch()
      pd.testing.assert_series_equal(
          raw.to_series(name="new_name"), result
      )
  
file_path: mars/mars/dataframe/tests/test_core.py
imports: import numpy
  import pandas
  import pytest
  from ...core import tile
  from ...lib.groupby_wrapper import wrapped_groupby
  from ...utils import pd_release_version
  from ..None import cut
  from ..initializer import DataFrame, Series, Index
label_desc: Use image node_id 7 for calling a global function with example usage: test_to_frame_or_series(setup) without return types