import json def read_json_file(file_name): # Read the JSONL file with open(file_name) as f: for line in f: txn = json.loads(line) # Yield valid transactions only if (txn['orderID'] != ""): yield(txn) txn_generator = read_json_file('retail_transactions.jsonl')