# Categorize the total amount of each transaction def add_features(sample_cases): for txn in sample_cases: price = txn['totalAmt'] if 0 <= price <= 1500: txn['totalAmtCat'] = 'Low' elif 1500 < price <= 3500: txn['totalAmtCat'] = 'Moderate' elif 3500 < price: txn['totalAmtCat'] = 'High' return sample_cases