File size: 314 Bytes
6c5a446
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
from sklearn.base import BaseEstimator, TransformerMixin

class UnitPriceTransformer(BaseEstimator, TransformerMixin):
    def fit(self, X, y=None):
        return self

    def transform(self, X):
        X['unit_price'] = X['sales'] / X['quantity']
        return X
# Include other custom transformers as needed