<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def calendar_dates(self, val):
 """ Update ``self._calendar_dates_g`` if ``self.calendar_dates`` changes. """

        self._calendar_dates = val
        if val is not None and not val.empty:
            self._calendar_dates_g = self._calendar_dates.groupby(
                ["service_id", "date"]
            )
        else:
            self._calendar_dates_g = None