merge_datasets function

Merge the datasets on the keys