Skip to content
C

Problem 1: Create an Interaction Feature

Easypython

Problem Description

Write a Python program that creates a new interaction feature by multiplying two existing numeric columns ("bedrooms" and "bathrooms") in a DataFrame.

Input

A DataFrame with "bedrooms" and "bathrooms" columns.

Output

The DataFrame with a new "bedbathinteraction" column.

Constraints

  • None specific.

Example Input

text
{"bedrooms": [2,3,4], "bathrooms": [1,2,3]}

Example Output

text
bedrooms bathrooms bed_bath_interaction 0 2 1 2 1 3 2 6 2 4 3 12

Concepts Covered

Column multiplication, new feature creation.

Input (stdin)

Output

Run your code to see output here...