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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.