<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(self, val):
 """ Update ``self._calendar_i``if ``self.calendar`` changes. """

        self._calendar = val
        if val is not None and not val.empty:
            self._calendar_i = self._calendar.set_index("service_id")
        else:
            self._calendar_i = None