1import pandas as pd
2
3l1 = [{'id': 9, 'av': 4}, {'id': 10, 'av': 0}, {'id': 8, 'av': 0}]
4l2 = [{'id': 9, 'nv': 45}, {'id': 10, 'nv': 0}, {'id': 8, 'nv': 30}]
5
6df1 = pd.DataFrame(l1).set_index('id')
7df2 = pd.DataFrame(l2).set_index('id')
8df = df1.merge(df2, left_index=True, right_index=True)
9df.T.to_dict()
10# {9: {'av': 4, 'nv': 45}, 10: {'av': 0, 'nv': 0}, 8: {'av': 0, 'nv': 30}}