class_docstr: Groupby-specific tests.
class_docstr_tok: ["Groupby-specific","tests","."]
code: def test_groupby_extension_no_sort(self, data_for_grouping):
      df = pd.DataFrame(
          {"A": [1, 1, 2, 2, 3, 3, 1, 4], "B": data_for_grouping}
      )
  
      is_bool = data_for_grouping.dtype._is_boolean
      if is_bool:
          # only 2 unique values, and the final entry has c==b
          #  (see data_for_grouping docstring)
          df = df.iloc[:-1]
  
      result = df.groupby("B", sort=False).A.mean()
      _, index = pd.factorize(data_for_grouping, sort=False)
  
      index = pd.Index(index, name="B")
      exp_vals = [1.0, 3.0, 4.0]
      if is_bool:
          exp_vals = exp_vals[:-1]
      expected = pd.Series(exp_vals, index=index, name="A")
      tm.assert_series_equal(result, expected)
  
file_path: pandas/pandas/tests/extension/base/groupby.py
imports: import re
  import pytest
  from pandas.core.dtypes.common import is_bool_dtype, is_numeric_dtype, is_object_dtype, is_string_dtype
  import pandas
  import pandas._testing
label_desc: Use image node_id 4 for calling the BaseGroupbyTests obj's underlying member method code with example usage: obj.test_groupby_extension_no_sort(data_for_grouping) without return types