code: def check_dataframe_column_names_consistency(name, estimator_orig):
      try:
          import pandas as pd
      except ImportError:
          raise SkipTest(
              "pandas is not installed: not checking column name consistency for pandas"
          )
  
      tags = _safe_tags(estimator_orig)
      is_supported_X_types = (
          "2darray" in tags["X_types"]
          or "categorical" in tags["X_types"]
      )
  
      if not is_supported_X_types or tags["no_validation"]:
          return
  
      rng = np.random.RandomState(0)
  
      estimator = clone(estimator_orig)
      set_random_state(estimator)
  
      X_orig = rng.normal(size=(150, 8))
  
      X_orig = _enforce_estimator_tags_x(estimator, X_orig)
      n_samples, n_features = X_orig.shape
  
      names = np.array([f"col_{i}" for i in range(n_features)])
      X = pd.DataFrame(X_orig, columns=names)
  
      if is_regressor(estimator):
          y = rng.normal(size=n_samples)
      else:
          y = rng.randint(low=0, high=2, size=n_samples)
      y = _enforce_estimator_tags_y(estimator, y)
  
      # Check that calling `fit` does not raise any warnings about feature names.
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "error",
              message="X does not have valid feature names",
              category=UserWarning,
              module="imblearn",
          )
          estimator.fit(X, y)
  
      if not hasattr(estimator, "feature_names_in_"):
          raise ValueError(
              "Estimator does not have a feature_names_in_ "
              "attribute after fitting with a dataframe"
          )
      assert isinstance(estimator.feature_names_in_, np.ndarray)
      assert estimator.feature_names_in_.dtype == object
      assert_array_equal(estimator.feature_names_in_, names)
  
      # Only check imblearn estimators for feature_names_in_ in docstring
      module_name = estimator_orig.__module__
      if (
          module_name.startswith("imblearn.")
          and not (
              "test_" in module_name or module_name.endswith("_testing")
          )
          and ("feature_names_in_" not in (estimator_orig.__doc__))
      ):
          raise ValueError(
              f"Estimator {name} does not document its feature_names_in_ attribute"
          )
  
      check_methods = []
      for method in (
          "predict",
          "transform",
          "decision_function",
          "predict_proba",
          "score",
          "score_samples",
          "predict_log_proba",
      ):
          if not hasattr(estimator, method):
              continue
  
          callable_method = getattr(estimator, method)
          if method == "score":
              callable_method = partial(callable_method, y=y)
          check_methods.append((method, callable_method))
  
      for _, method in check_methods:
          with warnings.catch_warnings():
              warnings.filterwarnings(
                  "error",
                  message="X does not have valid feature names",
                  category=UserWarning,
                  module="sklearn",
              )
              method(X)  # works without UserWarning for valid features
  
      invalid_names = [
          (
              names[::-1],
              "Feature names must be in the same order as they were in fit.",
          ),
          (
              [f"another_prefix_{i}" for i in range(n_features)],
              "Feature names unseen at fit time:\n- another_prefix_0\n-"
              " another_prefix_1\n",
          ),
          (
              names[:3],
              f"Feature names seen at fit time, yet now missing:\n- {min(names[3:])}\n",
          ),
      ]
      params = {
          key: value
          for key, value in estimator.get_params().items()
          if "early_stopping" in key
      }
      early_stopping_enabled = any(
          value is True for value in params.values()
      )
  
      for invalid_name, additional_message in invalid_names:
          X_bad = pd.DataFrame(X, columns=invalid_name)
  
          for name, method in check_methods:
              if sklearn_version >= parse_version("1.2"):
                  expected_msg = re.escape(
                      "The feature names should match those that were passed during fit."
                      f"\n{additional_message}"
                  )
                  with raises(
                      ValueError,
                      match=expected_msg,
                      err_msg=f"{name} did not raise",
                  ):
                      method(X_bad)
              else:
                  expected_msg = re.escape(
                      "The feature names should match those that were passed "
                      "during fit. Starting version 1.2, an error will be raised.\n"
                      f"{additional_message}"
                  )
                  with warnings.catch_warnings():
                      warnings.filterwarnings(
                          "error",
                          category=FutureWarning,
                          module="sklearn",
                      )
                      with raises(
                          FutureWarning,
                          match=expected_msg,
                          err_msg=f"{name} did not raise",
                      ):
                          method(X_bad)
  
          # partial_fit checks on second call
          # Do not call partial fit if early_stopping is on
          if (
              not hasattr(estimator, "partial_fit")
              or early_stopping_enabled
          ):
              continue
  
          estimator = clone(estimator_orig)
          if is_classifier(estimator):
              classes = np.unique(y)
              estimator.partial_fit(X, y, classes=classes)
          else:
              estimator.partial_fit(X, y)
  
          with raises(ValueError, match=expected_msg):
              estimator.partial_fit(X_bad, y)
  
imports: import re
  import sys
  import traceback
  import warnings
  from collections import Counter
  from functools import partial
  import numpy
  import pytest
  import sklearn
  from scipy import sparse
  from sklearn.base import clone, is_classifier, is_regressor
  from sklearn.cluster import KMeans
  from sklearn.datasets import load_iris, make_blobs, make_classification, make_multilabel_classification
  from sklearn.exceptions import SkipTestWarning
  from sklearn.preprocessing import StandardScaler, label_binarize
  from sklearn.utils._tags import _safe_tags
  from sklearn.utils._testing import SkipTest, assert_allclose, assert_array_equal, assert_raises_regex, raises, set_random_state
  from sklearn.utils.estimator_checks import _enforce_estimator_tags_y, _get_check_estimator_ids, _maybe_mark_xfail
  from sklearn.utils.fixes import parse_version
  from sklearn.utils.multiclass import type_of_target
  from imblearn.datasets import make_imbalance
  from imblearn.over_sampling.base import BaseOverSampler
  from imblearn.under_sampling.base import BaseCleaningSampler, BaseUnderSampler
  from imblearn.utils._param_validation import generate_invalid_param_val, make_constraint
label_desc: Use image node_id 25 for calling a global function with example usage: check_dataframe_column_names_consistency(name, estimator_orig) without return types