How it works...

In Step 2, we loaded the dataset into Python using the read_csv function. We only indicated which column contains the index and what symbol represents the missing values.

In Step 3, we identified the dependent variable (the target), as well as both numerical and categorical features. To do so, we used the select_dtypes methods and indicated what data type we wanted to extract. We stored the features in lists. We also had to remove the dependent variable from the list containing the numerical features. Lastly, we created a list containing all the transformations we wanted to apply to the data. We selected the following:

  • FillMissing: Missing values will be filled using the median of the feature's values. In the case of categorical ...

Get Python for Finance Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.