Repository: deepchecks/deepchecks

Issue:
[BUG] columns info shows all columns if model does not support FI 
**Describe the bug**
shows all columns instead of 10 on default

![Screen Shot 2022-04-21 at 12 21 20](https://user-images.githubusercontent.com/26321553/164969379-ab94999e-3a5f-47f9-a901-66c9a54341c8.png)



Discussion:

Resolving patch:
diff --git a/deepchecks/utils/features.py b/deepchecks/utils/features.py
--- a/deepchecks/utils/features.py
+++ b/deepchecks/utils/features.py
@@ -324,19 +324,18 @@ def column_importance_sorter_dict(
     feature_importances : t.Optional[pd.Series] , default: None
         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);
-        is used only if model was specified
+        amount of columns to show ordered by feature importance (date, index, label are first)
 
     Returns
     -------
     Dict
         the dict of columns sorted and limited by feature importance.
     """
-    if feature_importances is not None:
-        key = lambda name: get_importance(name[0], feature_importances, dataset)
-        cols_dict = dict(sorted(cols_dict.items(), key=key, reverse=True))
-        if n_top:
-            return dict(list(cols_dict.items())[:n_top])
+    feature_importances = {} if feature_importances is None else feature_importances
+    key = lambda name: get_importance(name[0], feature_importances, dataset)
+    cols_dict = dict(sorted(cols_dict.items(), key=key, reverse=True))
+    if n_top:
+        return dict(list(cols_dict.items())[:n_top])
     return cols_dict
 
 
@@ -371,11 +370,11 @@ def column_importance_sorter_df(
     if len(df) == 0:
         return df
 
-    if feature_importances is not None:
-        key = lambda column: [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)
+    feature_importances = {} if feature_importances is None else feature_importances
+    key = lambda column: [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


Test patch:
diff --git a/tests/base/to_json_test.py b/tests/base/to_json_test.py
--- a/tests/base/to_json_test.py
+++ b/tests/base/to_json_test.py
@@ -29,10 +29,9 @@ def test_check_full_suite_not_failing(iris_split_dataset_and_model):
 def test_check_metadata(iris_dataset):
     check_res = ColumnsInfo(n_top_columns=4).run(iris_dataset)
     json_res = jsonpickle.loads(check_res.to_json())
-    assert_that(json_res['value'], equal_to({'sepal length (cm)': 'numerical feature',
-                                            'sepal width (cm)': 'numerical feature',
-                                            'petal length (cm)': 'numerical feature',
-                                            'petal width (cm)': 'numerical feature',
-                                            'target': 'label'}))
+    assert_that(json_res['value'], equal_to({'target': 'label',
+                                             'sepal length (cm)': 'numerical feature',
+                                             'sepal width (cm)': 'numerical feature',
+                                             'petal length (cm)': 'numerical feature'}))
     assert_that(json_res['name'], equal_to('Columns Info'))
     assert_that(json_res['params'], equal_to({'n_top_columns': 4}))