I'm trying to sum the total monthly amount by the code below,
month_sum = df.groupby(([df['Year'], df['Month']]))['amount'].agg(np.sum)
But I need to drop those data or change the sum result to NaN if they do not contain enough days' data(eg: only 10 groups of data for January).
I only know I can drop data by dp.drop(), which drop data according to column characteristics...And I cannot use it in this situation. Can anyone show me how to do that?