Your question is Merging Data and Moving Average. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
A Booz Allen Hamilton AI Studio pipeline receives two unsorted datasets containing measurements for the same feature. Write a function that merges records with matching timestamps by averaging their feature values, then calculates a trailing moving average over the merged measurements.
Implement merge_and_moving_average(dataset_a, dataset_b, feature, window).
dataset_a and dataset_b are lists of dictionaries. Each dictionary contains an integer timestamp and the requested numeric feature.timestamp and moving_average.i uses the current merged value and up to window - 1 immediately preceding merged values. Near the beginning, use all available values.def merge_and_moving_average(dataset_a, dataset_b, feature, window):