Problem 3: Remove Low-Variance Features
Easypython
Learn the Concept: Feature SelectionProblem Description
Write a Python program that identifies and removes any numeric column whose variance is below a given threshold.
Input
A DataFrame with numeric columns, and a variance threshold value.
Output
The DataFrame with low-variance columns removed, and a list of which columns were dropped.
Constraints
- Threshold will be a small positive number (e.g., 0.01).
Example Input
text{"a": [1,1,1,1], "b": [10,20,30,40]}, threshold=0.01
Example Output
textDropped columns: ['a'] Remaining columns: ['b']
Concepts Covered
.var(), conditional column filtering.
Related Problems
- Problem 1: Compute and Display a Correlation MatrixEasy · pythonSolve Problem
- Problem 2: Identify Features Most Correlated with the TargetEasy · pythonSolve Problem
- Problem 4: Drop One of Two Highly Correlated FeaturesEasy · pythonSolve Problem