code: def asof(self, label):
          try:
              loc = self.get_loc(label, method='pad')
          except KeyError:
              return self._na_value
          else:
              if isinstance(loc, slice):
                  loc = loc.indices(len(self))[-1]
              return self[loc]