code: def column_importance_sorter_df(
      df: pd.DataFrame,
      ds: "tabular.Dataset",
      feature_importances: pd.Series,
      n_top: int = 10,
      col: t.Optional[Hashable] = None,
  ) -> pd.DataFrame:
      """Return the dataframe of columns sorted and limited by feature importance.
  
      Parameters
      ----------
      df : pd.DataFrame
          DataFrame to sort
      ds : tabular.Dataset
          dataset used to fit the model
      feature_importances : pd.Series
          feature importance normalized to 0-1 indexed by feature names
      n_top : int , default: 10
          amount of columns to show ordered by feature importance (date, index, label are first)
      col : t.Optional[Hashable] , default: None
          name of column to sort the dataframe
  
      Returns
      -------
      pd.DataFrame
          the dataframe sorted and limited by feature importance.
  
      """
      if len(df) == 0:
          return df
  
      feature_importances = (
          {} if feature_importances is None else feature_importances
      )
  
      def key(column):
          return [
              get_importance(name, feature_importances, ds)
              for name in column
          ]
  
      if col:
          df = df.sort_values(by=[col], key=key, ascending=False)
      df = df.sort_index(key=key, ascending=False)
      if n_top:
          return df.head(n_top)
      return df
  
imports: import time
  import typing
  import warnings
  import numpy
  import pandas
  from sklearn.inspection import permutation_importance
  from sklearn.pipeline import Pipeline
  from deepchecks import tabular
  from deepchecks.core import errors
  from deepchecks.core.errors import DeepchecksValueError
  from deepchecks.tabular.metric_utils.scorers import DeepcheckScorer, get_default_scorers, init_validate_scorers
  from deepchecks.tabular.utils.task_type import TaskType
  from deepchecks.tabular.utils.validation import validate_model
  from deepchecks.utils.logger import get_logger
  from deepchecks.utils.typing import Hashable
label_desc: Use image node_id 7 for calling a global function with example usage: column_importance_sorter_df(df, ds, feature_importances, n_top, col) and returns: df, df, unknown, df