Combining numerical features
In Chapter 8, Creating New Features, we saw that we can create new features by combining variables with mathematical operations. The featuretools
library supports several operations for combining variables, including addition, division, modulo, and multiplication. In this recipe, we will learn how to combine these features with featuretools
.
How to do it...
Let’s begin by importing the libraries and getting the dataset ready:
- First, we’ll import
pandas
,featuretools
, and theCategorical
logical type:import pandas as pd import featuretools as ft from woodwork.logical_types import Categorical
- Let’s load the dataset that described in the Technical requirements section:
df = pd.read_csv( «retail.csv», parse_dates=[«invoice_date»])
- Let’s set up an entity set:
es = ft.EntitySet(id="data")
- Let’s add the DataFrame to the entity set:
es = es.add_dataframe...