@@ -443,47 +443,47 @@ def test_string_index(self):
443443 result = enc .fit_transform (X , y )
444444 self .assertFalse (result .isnull ().values .any (), 'There should not be any missing value!' )
445445
446- def test_get_feature_names (self ):
446+ def test_get_feature_names_out (self ):
447447 for encoder_name in encoders .__all__ :
448448 with self .subTest (encoder_name = encoder_name ):
449449 enc = getattr (encoders , encoder_name )()
450450 # Target encoders also need y
451451 if enc ._get_tags ().get ('supervised_encoder' ):
452- obtained = enc .fit (X , y ).get_feature_names ()
452+ obtained = enc .fit (X , y ).get_feature_names_out ()
453453 expected = enc .transform (X , y ).columns .tolist ()
454454 else :
455- obtained = enc .fit (X ).get_feature_names ()
455+ obtained = enc .fit (X ).get_feature_names_out ()
456456 expected = enc .transform (X ).columns .tolist ()
457457 self .assertEqual (obtained , expected )
458458
459- def test_get_feature_names_drop_invariant (self ):
459+ def test_get_feature_names_out_drop_invariant (self ):
460460 # TODO: What could a DF look like that results in constant
461461 # columns for all encoders?
462462 for encoder_name in encoders .__all__ :
463463 with self .subTest (encoder_name = encoder_name ):
464464 enc = getattr (encoders , encoder_name )(drop_invariant = True )
465465 # Target encoders also need y
466466 if enc ._get_tags ().get ('supervised_encoder' ):
467- obtained = enc .fit (X , y ).get_feature_names ()
467+ obtained = enc .fit (X , y ).get_feature_names_out ()
468468 expected = enc .transform (X , y ).columns .tolist ()
469469 else :
470- obtained = enc .fit (X ).get_feature_names ()
470+ obtained = enc .fit (X ).get_feature_names_out ()
471471 expected = enc .transform (X ).columns .tolist ()
472472 self .assertEqual (obtained , expected )
473473
474- def test_get_feature_names_not_set (self ):
474+ def test_get_feature_names_out_not_set (self ):
475475 for encoder_name in encoders .__all__ :
476476 with self .subTest (encoder_name = encoder_name ):
477477 enc = getattr (encoders , encoder_name )()
478- self .assertRaises (ValueError , enc .get_feature_names )
478+ self .assertRaises (ValueError , enc .get_feature_names_out )
479479
480- def test_get_feature_names_after_transform (self ):
480+ def test_get_feature_names_out_after_transform (self ):
481481 for encoder_name in encoders .__all__ :
482482 with self .subTest (encoder_name = encoder_name ):
483483 enc = getattr (encoders , encoder_name )()
484484 enc .fit (X , y )
485485 out = enc .transform (X_t )
486- self .assertEqual (set (enc .get_feature_names ()), set (out .columns ))
486+ self .assertEqual (set (enc .get_feature_names_out ()), set (out .columns ))
487487
488488 def test_truncated_index (self ):
489489 # see: https://github.com/scikit-learn-contrib/categorical-encoding/issues/152
0 commit comments