How it works...
The pandas library has plenty of built-in operations to compare one feature or a subset of features to a single reference variable. In this recipe, we used the pandas sub() and div() methods to determine the difference or the ratio between two variables or a subset of variables and one reference feature.
First, we loaded the Breast Cancer dataset from scikit-learn. Next, we subtracted one variable from another. To do this, we applied the sub() method to a pandas Series with the first variable, passing the second pandas Series with the second variable within the method, which returned a third pandas Series with the second variable subtracted from the first one. To divide one variable from another, we used the div() method, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access