16 lines
573 B
Python
16 lines
573 B
Python
def preprocess_loan_charges_data(data):
|
|
"""
|
|
Preprocesses the data into a dictionary for efficient lookups by 'code'.
|
|
|
|
Args:
|
|
data: A list of dictionaries.
|
|
|
|
Returns:
|
|
A dictionary where keys are 'code' values and values are the corresponding dictionaries from the input data.
|
|
If multiple items have the same code, the last one encountered will be stored.
|
|
"""
|
|
preprocessed = {}
|
|
for item in data:
|
|
if 'code' in item:
|
|
preprocessed[item['code']] = item
|
|
return preprocessed |