# variance threshold, returning the names of the selected features

I am trying the variance threshold method for the first time and I am following the example in sklearn to work on it.

>>> X = [[0, 2, 0, 3], [0, 1, 4, 3], [0, 1, 1, 3]]
>>> selector = VarianceThreshold()
>>> selector.fit_transform(X)
array([[2, 0],
[1, 4],
[1, 1]])


However, at the end, it only returns an array of the values of the selected features. How can I get the name of the features that met the variance threshold limit here? I just need the names of the selected features.

Use selector.get_support (Documentation). This will give you a mask of the features that were selected and features that were discarded.
>>> selector.get_support()

>>> [ i for i, f in enumerate(selector.get_support()) if f ]