code: def test_to_pandas():
      rs = np.random.RandomState(0)
      df = pd.DataFrame(
          {
              "a": rs.rand(100),
              "b": ["s" + str(i) for i in rs.randint(100, size=100)],
              "c": [
                  ["ss0" + str(i), "ss1" + str(i)]
                  for i in rs.randint(100, size=100)
              ],
          }
      )
  
      batch_size = 15
      n_batch = len(df) // 15 + 1
      batches = [
          pa.RecordBatch.from_pandas(
              df[i * batch_size : (i + 1) * batch_size]
          )
          for i in range(n_batch)
      ]
      table = pa.Table.from_batches(batches)
  
      df1 = arrow_table_to_pandas_dataframe(
          table, use_arrow_dtype=False
      )
      assert df1.dtypes.iloc[1] == np.dtype("O")
      assert df1.dtypes.iloc[2] == np.dtype("O")
  
      df2 = arrow_table_to_pandas_dataframe(table)
      assert df2.dtypes.iloc[1] == ArrowStringDtype()
      assert df2.dtypes.iloc[2] == ArrowListDtype(str)
      assert (
          df2.memory_usage(deep=True).sum()
          < df.memory_usage(deep=True).sum()
      )
  
      # test df method
      df4 = df2.groupby("b").sum()
      df4.index = df4.index.astype(object)
      expected = df.groupby("b").sum()
      pd.testing.assert_frame_equal(df4, expected)
  
      s = ("s" + df2["b"]).astype("string")
      expected = ("s" + df["b"]).astype("string")
      pd.testing.assert_series_equal(s, expected)
  
      s2 = df2["b"].str[:2]
      expected = df["b"].astype("string").str[:2]
      pd.testing.assert_series_equal(s2, expected)
  
      # test reverse conversion to arrow
      arrow_data = pa.RecordBatch.from_pandas(df2)
      assert arrow_data.num_rows == len(df2)
  
file_path: mars/mars/dataframe/tests/test_arrays.py
imports: import numpy
  import pandas
  import pytest
  from ...config import option_context
  from ...core import enter_mode
  from ..None import ArrowStringDtype, ArrowStringArray, ArrowListDtype, ArrowListArray
  from ..arrays import _use_bool_any_all
  from ..utils import arrow_table_to_pandas_dataframe
label_desc: Use image node_id 6 for calling a global function with example usage: test_to_pandas() without return types