Retain feature names after Scikit Feature Selection

后端 未结 5 1387
感情败类
感情败类 2021-02-07 13:16

After running a Variance Threshold from Scikit-Learn on a set of data, it removes a couple of features. I feel I\'m doing something simple yet stupid, but I\'d like to retain th

5条回答
  •  你的背包
    2021-02-07 14:04

    I came here looking for a way to get transform() or fit_transform() to return a data frame, but I suspect it's not supported.

    However, you can subset the data a bit more cleanly like this:

    data_transformed = data.loc[:, selector.get_support()]
    

提交回复
热议问题