Question: Create a custom transformer that: Inherits from BaseEstimator and TransformerMixin. Implements the fit and transform methods. Accepts a DataFrame as input. In the transform method:
Create a custom transformer that:
Inherits from BaseEstimator and TransformerMixin.
Implements the fit and transform methods.
Accepts a DataFrame as input.
In the transform method:
Create a new column called absencessum that sums the absencesG absencesG and absencesG columns, adds the new absencessum column to the end of the DataFrame, then drops the original three absence columns.Drop the G and G columns if the parameter dropgrades is True. It will keep the columns if dropgrades is False.
Name the custom transformer class GradeTransformer.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
