Skip to content

Commit 7302e78

Browse files
committed
features can be str or array fix
1 parent 4040aaa commit 7302e78

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

doc/whats_new/upcoming_changes/many-modules/31937.enhancement.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
showing the number and names of the output features when using a
44
:class:`compose.ColumnTransformer` or a :class:`pipeline.FeatureUnion`. A copy-paste
55
button is available for the output features name.
6-
By :user:`Dea María Léon <DeaMariaLeon>`, :user:`Guillaume Lemaitre <glemaitre>`
6+
By :user:`Dea María Léon <DeaMariaLeon>`, :user:`Guillaume Lemaitre <glemaitre>`,
7+
:user:`Jérémie du Boisberranger <jeremiedbb>`,
78
and :user:`Olivier Grisel <ogrisel>`.

sklearn/utils/_repr_html/estimator.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def _write_label_html(
104104
name_details,
105105
name_caption=None,
106106
doc_link_label=None,
107-
features="",
107+
features=None,
108108
outer_class="sk-label-container",
109109
inner_class="sk-label",
110110
checked=False,
@@ -218,10 +218,11 @@ def _write_label_html(
218218
out.write(f"<pre>{name_details}</pre>")
219219

220220
out.write("</div>")
221-
if len(features) == 0:
221+
if features is None or len(features) == 0:
222222
features_div = ""
223223
else:
224224
features_div = _features_html(features, is_fitted_css_class)
225+
225226
out.write("</div></div>")
226227
out.write(features_div)
227228

@@ -363,7 +364,7 @@ def _write_estimator_html(
363364
estimator_label,
364365
estimator_label_details,
365366
doc_link=doc_link,
366-
features="",
367+
features=None,
367368
is_fitted_css_class=is_fitted_css_class,
368369
is_fitted_icon=is_fitted_icon,
369370
param_prefix=param_prefix,

0 commit comments

Comments
 (0)