Ratios
Ratios are all around us. Whether it's miles per gallon or click through rate, they are everywhere. In this exercise, we'll create some ratios by dividing out pairs of columns.
Это упражнение является частью курса
Feature Engineering with PySpark
Инструкции к упражнению
- Create a new variable
ASSESSED_TO_LISTby dividingASSESSEDVALUATIONbyLISTPRICEto help us understand if the having a high or low assessment value impacts our price. - Create another new variable
TAX_TO_LISTto help us understand the approximate tax rate by dividingTAXESbyLISTPRICE. - Lastly create another variable
BED_TO_BATHSto help us know how crowded our bathrooms might be by dividingBEDROOMSbyBATHSTOTAL.
Интерактивное практическое упражнение
Попробуйте выполнить это упражнение, дополнив этот пример кода.
# ASSESSED_TO_LIST
df = ____
df[['ASSESSEDVALUATION', 'LISTPRICE', 'ASSESSED_TO_LIST']].show(5)
# TAX_TO_LIST
df = ____
df[['TAX_TO_LIST', 'TAXES', 'LISTPRICE']].show(5)
# BED_TO_BATHS
df = ____
df[['BED_TO_BATHS', 'BEDROOMS', 'BATHSTOTAL']].show(5)