Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a custom transformer, similar to the custom transformer that we saw in the California House Prices module example. Go back and review that code,

Create a custom transformer, similar to the custom transformer that we saw in the California House Prices module example. Go back and review that code, making sure that you understand the various pieces, in order to more easily create this custom transformer.
Exercise 3: Create a custom transformer that takes the numerical columns from your data and performs the following transformations:
1) You must name your custom transformer class Assignment3Transformer 2) Your class should include an input parameter called create_new_column with a default value of True that performs the following two data preparation steps when its value is True, but skips these steps and just returns the DataFrame as is when you pass a value of False.
Adds an attribute to the end of the numerical data (i.e. new last column) that is the result of the days_per_week column multiplied by the hours_per_day column. We are creating this column to better compare the amount of hours worked between the individuals.
Since they are not needed with the new column, delete the days_per_week and hours_per_day columns.
Remember that you only want these two steps to occur when the create_new_column parameter is True. Your custom transfomer will be tested in CodeGrade to make sure these steps are not ran when the create_new_column parameter is False.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application And Administration

Authors: Michael Mannino, Michael V. Mannino

2nd Edition

0072880678, 9780072880670

More Books

Students also viewed these Databases questions