resampling on a MultiIndex
I posed this issue on SO but was hoping to get a more detailed explanation. I have a df that has an `(id, date)` `MultiIndex`. I would like to resample the df within each `id`. Intuitively I thought the code should look something like:

````
df = pd.DataFrame(data = {"val": np.arange(30), 
                          "id": np.tile([1,2], 15),
                          "date": np.repeat(pd.date_range(start = "2000-01-01", periods = 15, name="date"), 2)
                         })

df = df.set_index(["id", "date"]).sort_index() 
df.groupby("id")["val"].resample(rule = "M", closed = "right", label = "right").apply(lambda x: np.sqrt(sum(x)/10))
````

This raises an exception and the working answer suggests that I only have `date` as the index leaving the `id` as a column, then group by that column and resample. Namely, instead of `df.set_index(["id", "date"]).sort_index() ` just `df.set_index("date").sort_index() ` and then everything else should work as is. I'm a bit confused why my original attempt failed. My understanding of `groupby` is that it will create an object that has grouping information and all the methods on that object respect that grouping information by operating on each group only. Specifically the index or column that the df is grouped on will be absent from the group subframe passed to any methods and will only be used to cat the results together. Therefore, I expected that `resample` would receive a df with only a `date` index rather than a `MultiIndex`. Am I think about this completely incorrectly?