Create a new column
In the last exercise, you converted the column plane_year to an integer. This column holds the year each plane was manufactured. However, your model will use the planes' age, which is slightly different from the year it was made!
Это упражнение является частью курса
Foundations of PySpark
Инструкции к упражнению
- Create the column
plane_ageusing the.withColumn()method and subtracting the year of manufacture (columnplane_year) from the year (columnyear) of the flight.
Интерактивное практическое упражнение
Попробуйте выполнить это упражнение, дополнив этот пример кода.
# Create the column plane_age
model_data = model_data.withColumn("plane_age", ____.____ - ____.____)