import csv from collections import defaultdict filename = 'orders_export_1 (8)(1).csv' total_lineitem_price = 0 total_with_qty = 0 total_with_discount = 0 with open(filename, 'r', encoding='utf-8-sig') as f: reader = csv.DictReader(f) for row in reader: name = row.get('Lineitem name', '').upper() if 'CLUB 78' in name or 'PADEL 78' in name or 'PADEL' in name: price = float(row.get('Lineitem price') or 0) qty = int(row.get('Lineitem quantity') or 0) discount = float(row.get('Lineitem discount') or 0) total_lineitem_price += price total_with_qty += (price * qty) total_with_discount += (price * qty) - discount print(f"Total price only: {total_lineitem_price}") print(f"Total with qty: {total_with_qty}") print(f"Total with discount: {total_with_discount}")