in [ ]from sklearn feature_selection import variancethreshold vt variancethreshold(threshold vt fit(poke_genout[ ]variancethreshold(threshold= to view the variances as well as which features were finally selected by this algorithmwe can use the variances_ property and the get_supportfunction respectively the following snippet depicts this clearly in formatted dataframe in [ ]pd dataframe({'variance'vt variances_'select_feature'vt get_support()}index=poke_gen columnst out[ ]gen gen gen gen gen gen select_feature true false true false true false variance we can clearly see which features have been selected based on their true values and also their variance being above to get the final subset of selected featuresyou can use the following code in [ ]poke_gen_subset poke_gen iloc[:,vt get_support()head(poke_gen_subset out[ ]gen gen gen the preceding feature subset depicts that features gen gen and gen have been finally selected out of the original six features statistical methods another widely used filter based feature selection methodwhich is slightly more sophisticatedis to select features based on univariate statistical tests you can use several statistical tests for regression and classification based models including mutual informationanova (analysis of varianceand chi-square tests based on scores obtained from these statistical testsyou can select the best features on the basis of their score let' load sample dataset now with features this dataset is known as the wisconsin diagnostic breast cancer datasetwhich is also available in its native or raw format at ics uci edu/ml/datasets/breast+cancer+wisconsin+(diagnostic)which is the uci machine learning repository we will use scikit-learn to load the data features and the response class variable in [ ]from sklearn datasets import load_breast_cancer bc_data load_breast_cancer(bc_features pd dataframe(bc_data datacolumns=bc_data feature_namesbc_classes pd dataframe(bc_data targetcolumns=['ismalignant']