code: def test_dataframe_and_series(setup, func_name, func_opts):
      if func_opts.func_name in ["__and__", "__or__", "__xor__"]:
          # pandas fails to compute some expected values due to `na`.
          return
  
      data1 = pd.DataFrame(
          np.random.rand(10, 10),
          index=np.arange(10),
          columns=[4, 1, 3, 2, 10, 5, 9, 8, 6, 7],
      )
      data1 = to_boolean_if_needed(func_opts.func_name, data1)
      data2 = pd.DataFrame(
          np.random.rand(10, 10),
          index=np.arange(11, 1, -1),
          columns=[5, 9, 12, 3, 11, 10, 6, 4, 1, 2],
      )
      data2 = to_boolean_if_needed(func_opts.func_name, data2)
  
      s1 = from_pandas_series(data2[1], chunk_size=(6,))
  
      # operate on single-column dataframe and series
      df1 = from_pandas(data1[[1]], chunk_size=(5, 5))
      r1 = getattr(df1, func_opts.func_name)(s1, axis="index")
  
      expected = getattr(data1[[1]], func_opts.func_name)(
          data2[1], axis="index"
      )
      result = r1.execute().fetch()
      pd.testing.assert_frame_equal(
          sort_dataframe(expected), sort_dataframe(result)
      )
  
      # operate on dataframe and series without shuffle
      df2 = from_pandas(data1, chunk_size=(5, 5))
      r2 = getattr(df2, func_opts.func_name)(s1, axis="index")
  
      expected = getattr(data1, func_opts.func_name)(
          data2[1], axis="index"
      )
      result = r2.execute().fetch()
      pd.testing.assert_frame_equal(
          sort_dataframe(expected), sort_dataframe(result)
      )
  
      # operate on dataframe and series with shuffle
      df3 = from_pandas(data1, chunk_size=(5, 5))
      r3 = getattr(df3, func_opts.func_name)(s1, axis="columns")
  
      expected = getattr(data1, func_opts.func_name)(
          data2[1], axis="columns"
      )
      result = r3.execute().fetch()
      pd.testing.assert_frame_equal(
          sort_dataframe(expected), sort_dataframe(result)
      )
  
      # test both one chunk, axis=0
      pdf = pd.DataFrame(
          {"ca": [1, 3, 2], "cb": [360, 180, 2]}, index=[1, 2, 3]
      )
      pdf = to_boolean_if_needed(func_opts.func_name, pdf)
      df = from_pandas(pdf)
      series = pd.Series([0, 1, 2], index=[1, 2, 3])
      mars_series = from_pandas_series(series)
      result = (
          getattr(df, func_opts.func_name)(mars_series, axis=0)
          .execute()
          .fetch()
      )
      expected = getattr(pdf, func_opts.func_name)(series, axis=0)
      pd.testing.assert_frame_equal(
          sort_dataframe(expected), sort_dataframe(result)
      )
  
      # test different number of chunks, axis=0
      pdf = pd.DataFrame(
          {"ca": [1, 3, 2], "cb": [360, 180, 2]}, index=[1, 2, 3]
      )
      pdf = to_boolean_if_needed(func_opts.func_name, pdf)
      df = from_pandas(pdf, chunk_size=1)
      series = pd.Series([0, 1, 2], index=[1, 2, 3])
      mars_series = from_pandas_series(series)
      result = (
          getattr(df, func_opts.func_name)(mars_series, axis=0)
          .execute()
          .fetch()
      )
      expected = getattr(pdf, func_opts.func_name)(series, axis=0)
      pd.testing.assert_frame_equal(
          sort_dataframe(expected), sort_dataframe(result)
      )
  
      # test with row shuffle, axis=0
      pdf = pd.DataFrame(
          {"ca": [1, 3, 2], "cb": [360, 180, 2]}, index=[2, 1, 3]
      )
      pdf = to_boolean_if_needed(func_opts.func_name, pdf)
      df = from_pandas(pdf, chunk_size=1)
      series = pd.Series([0, 1, 2], index=[3, 1, 2])
      mars_series = from_pandas_series(series)
      result = (
          getattr(df, func_opts.func_name)(mars_series, axis=0)
          .execute()
          .fetch()
      )
      expected = getattr(pdf, func_opts.func_name)(
          series, axis=0
      ).reindex([3, 1, 2])
      # modify the order of rows
      result = result.reindex(index=[3, 1, 2])
      pd.testing.assert_frame_equal(
          sort_dataframe(expected), sort_dataframe(result)
      )
  
      # test both one chunk, axis=1
      pdf = pd.DataFrame(
          {1: [1, 3, 2], 2: [360, 180, 2], 3: [1, 2, 3]},
          index=["ra", "rb", "rc"],
      )
      pdf = to_boolean_if_needed(func_opts.func_name, pdf)
      df = from_pandas(pdf)
      series = pd.Series([0, 1, 2], index=[1, 2, 3])
      mars_series = from_pandas_series(series)
      result = (
          getattr(df, func_opts.func_name)(mars_series, axis=1)
          .execute()
          .fetch()
      )
      expected = getattr(pdf, func_opts.func_name)(series, axis=1)
      pd.testing.assert_frame_equal(
          sort_dataframe(expected), sort_dataframe(result)
      )
  
      # test different number of chunks, axis=1
      pdf = pd.DataFrame(
          {1: [1, 3, 2], 2: [360, 180, 2], 3: [1, 2, 3]},
          index=["ra", "rb", "rc"],
      )
      pdf = to_boolean_if_needed(func_opts.func_name, pdf)
      df = from_pandas(pdf, chunk_size=1)
      series = pd.Series([0, 1, 2], index=[1, 2, 3])
      mars_series = from_pandas_series(series)
      result = (
          getattr(df, func_opts.func_name)(mars_series, axis=1)
          .execute()
          .fetch()
      )
      expected = getattr(pdf, func_opts.func_name)(series, axis=1)
      pd.testing.assert_frame_equal(
          sort_dataframe(expected), sort_dataframe(result)
      )
  
      # test with row shuffle, axis=1
      pdf = pd.DataFrame(
          {1: [1, 3, 2], 3: [1, 2, 3], 2: [360, 180, 2]},
          index=["ra", "rb", "rc"],
      )
      pdf = to_boolean_if_needed(func_opts.func_name, pdf)
      df = from_pandas(pdf, chunk_size=1)
      series = pd.Series([0, 1, 2], index=[3, 1, 2])
      mars_series = from_pandas_series(series)
      result = (
          getattr(df, func_opts.func_name)(mars_series, axis=1)
          .execute()
          .fetch()
      )
      expected = getattr(pdf, func_opts.func_name)(series, axis=1)
      # modify the order of columns
      result = result[[1, 2, 3]]
      pd.testing.assert_frame_equal(expected, result)
  
imports: import operator
  from dataclasses import dataclass
  from functools import partial
  from typing import Callable, Union
  import numpy
  import pandas
  import pytest
  from ....None import tensor
  from ....tensor.datasource import array
  from ....utils import dataslots
  from ...None import to_datetime
  from ...datasource.dataframe import from_pandas
  from ...datasource.series import from_pandas
  from ..tests.test_arithmetic import comp_func
label_desc: Use image node_id 15 for calling a global function with example usage: test_dataframe_and_series(setup, func_name, func_opts) without return types