code: def test_from_pandas(ray_start_regular_shared, enable_pandas_block):
      ctx = ray.data.context.DataContext.get_current()
      old_enable_pandas_block = ctx.enable_pandas_block
      ctx.enable_pandas_block = enable_pandas_block
      try:
          df1 = pd.DataFrame({"one": [1, 2, 3], "two": ["a", "b", "c"]})
          df2 = pd.DataFrame({"one": [4, 5, 6], "two": ["e", "f", "g"]})
          ds = ray.data.from_pandas([df1, df2])
          block = ray.get(ds.get_internal_block_refs()[0])
          assert (
              isinstance(block, pd.DataFrame)
              if enable_pandas_block
              else isinstance(block, pa.Table)
          )
          values = [(r["one"], r["two"]) for r in ds.take(6)]
          rows = [
              (r.one, r.two)
              for _, r in pd.concat([df1, df2]).iterrows()
          ]
          assert values == rows
          # Check that metadata fetch is included in stats.
          assert "FromPandas" in ds.stats()
  
          # test from single pandas dataframe
          ds = ray.data.from_pandas(df1)
          block = ray.get(ds.get_internal_block_refs()[0])
          assert (
              isinstance(block, pd.DataFrame)
              if enable_pandas_block
              else isinstance(block, pa.Table)
          )
          values = [(r["one"], r["two"]) for r in ds.take(3)]
          rows = [(r.one, r.two) for _, r in df1.iterrows()]
          assert values == rows
          # Check that metadata fetch is included in stats.
          assert "FromPandas" in ds.stats()
      finally:
          ctx.enable_pandas_block = old_enable_pandas_block
  
file_path: ray/python/ray/data/tests/test_pandas.py
imports: import numpy
  import pandas
  import pyarrow
  import pytest
  import ray
  from ray.data.extensions import ArrowTensorArray, ArrowTensorType, TensorDtype
  from ray.data.tests.conftest import *
  from ray.data.tests.mock_http_server import *
  from ray.tests.conftest import *
label_desc: Use image node_id 1 for calling a global function with example usage: test_from_pandas(ray_start_regular_shared, enable_pandas_block) without return types