如何在熊猫中将表与数据框的每个组连接

我有一个像下面的数据框。每个日期是每周的星期一。

df = pd.DataFrame({'date' :['2020-04-20', '2020-05-11','2020-05-18',
                                 '2020-04-20', '2020-04-27','2020-05-04','2020-05-18'],
                         'name': ['A', 'A', 'A', 'B', 'B', 'B', 'B'], 
                          'count': [23, 44, 125, 6, 9, 10, 122]})

    date      name  count
0   2020-04-20  A   23
1   2020-05-11  A   44
2   2020-05-18  A   125
3   2020-04-20  B   6
4   2020-04-27  B   9
5   2020-05-04  B   10
6   2020-05-18  B   122

“ A”和“ B”都不能覆盖整个日期范围。他们两个都有一些缺失的日期,这意味着该周的计数为0。以下是所有日期:

df_dates = pd.DataFrame({ 'date':['2020-04-20', '2020-04-27','2020-05-04','2020-05-11','2020-05-18'] }) 

所以我需要像下面的数据框:

    date      name  count
0   2020-04-20  A   23
1   2020-04-27  A   0
2   2020-05-04  A   0
3   2020-05-11  A   44
4   2020-05-18  A   125
5   2020-04-20  B   6
6   2020-04-27  B   9
7   2020-05-04  B   10
8   2020-05-11  B   0
9   2020-05-18  B   122

It seems like I need to join (merge) df_dates with df for each name group ( A and B) and then fill the data with missing name and missing count value with 0's. Does anyone know achieve that? how I can join with another table with a grouped table?

我试过了,没有运气...

pd.merge(df_dates, df.groupby('name'), how='left', on='date')