code: def test_loc_getitem(setup):
      rs = np.random.RandomState(0)
      # index and columns are labels
      raw1 = pd.DataFrame(
          rs.randint(10, size=(5, 4)),
          index=["a1", "a2", "a3", "a4", "a5"],
          columns=["a", "b", "c", "d"],
      )
      # columns are labels
      raw2 = raw1.copy()
      raw2.reset_index(inplace=True, drop=True)
      # columns are non unique and monotonic
      raw3 = raw1.copy()
      raw3.columns = ["a", "b", "b", "d"]
      # columns are non unique and non monotonic
      raw4 = raw1.copy()
      raw4.columns = ["b", "a", "b", "d"]
      # index that is timestamp
      raw5 = raw1.copy()
      raw5.index = pd.date_range("2020-1-1", periods=5)
      raw6 = raw1[:0]
  
      df1 = md.DataFrame(raw1, chunk_size=2)
      df2 = md.DataFrame(raw2, chunk_size=2)
      df3 = md.DataFrame(raw3, chunk_size=2)
      df4 = md.DataFrame(raw4, chunk_size=2)
      df5 = md.DataFrame(raw5, chunk_size=2)
      df6 = md.DataFrame(raw6)
  
      df = df2.loc[3, "b"]
      result = df.execute().fetch()
      expected = raw2.loc[3, "b"]
      assert result == expected
  
      df = df1.loc["a3", "b"]
      result = df.execute(extra_config={"check_shape": False}).fetch()
      expected = raw1.loc["a3", "b"]
      assert result == expected
  
      # test empty list
      df = df1.loc[[]]
      result = df.execute().fetch()
      expected = raw1.loc[[]]
      pd.testing.assert_frame_equal(result, expected)
  
      df = df2.loc[[]]
      result = df.execute().fetch()
      expected = raw2.loc[[]]
      pd.testing.assert_frame_equal(result, expected)
  
      df = df2.loc[1:4]
      result = df.execute().fetch()
      expected = raw2.loc[1:4]
      pd.testing.assert_frame_equal(result, expected)
  
      df = df2.loc[1:4, "b":"d"]
      result = df.execute().fetch()
      expected = raw2.loc[1:4, "b":"d"]
      pd.testing.assert_frame_equal(result, expected)
  
      df = df2.loc[:4, "b":]
      result = df.execute().fetch()
      expected = raw2.loc[:4, "b":]
      pd.testing.assert_frame_equal(result, expected)
  
      # slice on axis index whose index_value does not have value
      df = df1.loc["a2":"a4", "b":]
      result = df.execute().fetch()
      expected = raw1.loc["a2":"a4", "b":]
      pd.testing.assert_frame_equal(result, expected)
  
      df = df2.loc[:, "b"]
      result = df.execute().fetch()
      expected = raw2.loc[:, "b"]
      pd.testing.assert_series_equal(result, expected)
      df = df2.loc[:, ["b", "a"]]
      result = df.execute().fetch()
      expected = raw2.loc[:, ["b", "a"]]
      pd.testing.assert_frame_equal(result, expected)
  
      # 'b' is non-unique
      df = df3.loc[:, "b"]
      result = df.execute().fetch()
      expected = raw3.loc[:, "b"]
      pd.testing.assert_frame_equal(result, expected)
  
      # 'b' is non-unique, and non-monotonic
      df = df4.loc[:, "b"]
      result = df.execute().fetch()
      expected = raw4.loc[:, "b"]
      pd.testing.assert_frame_equal(result, expected)
  
      # label on axis 0
      df = df1.loc["a2", :]
      result = df.execute().fetch()
      expected = raw1.loc["a2", :]
      pd.testing.assert_series_equal(result, expected)
  
      # label-based fancy index
      df = df2.loc[[3, 0, 1], ["c", "a", "d"]]
      result = df.execute().fetch()
      expected = raw2.loc[[3, 0, 1], ["c", "a", "d"]]
      pd.testing.assert_frame_equal(result, expected)
      df = df2[df2["a"] < 10]
      df = df.loc[[3, 0, 1], ["c", "a", "d"]]
      result = df.execute().fetch()
      expected = raw2.loc[[3, 0, 1], ["c", "a", "d"]]
      pd.testing.assert_frame_equal(result, expected)
  
      # label-based fancy index, asc sorted
      df = df2.loc[[0, 1, 3], ["a", "c", "d"]]
      result = df.execute().fetch()
      expected = raw2.loc[[0, 1, 3], ["a", "c", "d"]]
      pd.testing.assert_frame_equal(result, expected)
  
      # label-based fancy index in which non-unique exists
      selection = rs.randint(2, size=(5,), dtype=bool)
      df = df3.loc[selection, ["b", "a", "d"]]
      result = df.execute().fetch()
      expected = raw3.loc[selection, ["b", "a", "d"]]
      pd.testing.assert_frame_equal(result, expected)
  
      df = df3.loc[md.Series(selection), ["b", "a", "d"]]
      result = df.execute().fetch()
      expected = raw3.loc[selection, ["b", "a", "d"]]
      pd.testing.assert_frame_equal(result, expected)
  
      # label-based fancy index on index
      # whose index_value does not have value
      df = df1.loc[["a3", "a1"], ["b", "a", "d"]]
      result = df.execute(extra_config={"check_nsplits": False}).fetch()
      expected = raw1.loc[["a3", "a1"], ["b", "a", "d"]]
      pd.testing.assert_frame_equal(result, expected)
  
      # get timestamp by str
      df = df5.loc["20200101"]
      result = df.execute(
          extra_config={"check_series_name": False}
      ).fetch(extra_config={"check_series_name": False})
      expected = raw5.loc["20200101"]
      pd.testing.assert_series_equal(result, expected)
  
      # get timestamp by str, return scalar
      df = df5.loc["2020-1-1", "c"]
      result = df.execute().fetch()
      expected = raw5.loc["2020-1-1", "c"]
      assert result == expected
  
      # test empty df
      df = df6.loc[[]]
      result = df.execute().fetch()
      expected = raw6.loc[[]]
      pd.testing.assert_frame_equal(result, expected)
  
imports: import os
  import tempfile
  import mars
  import numpy
  import pandas
  import pytest
  from ....None import dataframe
  from ....None import tensor
  from ....utils import pd_release_version
  from ...datasource.read_csv import DataFrameReadCSV
  from ...datasource.read_sql import DataFrameReadSQL
  from ...datasource.read_parquet import DataFrameReadParquet
label_desc: Use image node_id 4 for calling a global function with example usage: test_loc_getitem(setup) without return types