code: def _compute_derivatives(self):
          
          derivatives = []
          for i, (timestamp, value) in enumerate(self.time_series_items):
              if i > 0:
                  pre_item = self.time_series_items[i - 1]
                  pre_timestamp = pre_item[0]
                  pre_value = pre_item[1]
                  td = timestamp - pre_timestamp
                  derivative = (value - pre_value) / td if td != 0 else value - pre_value
                  derivative = abs(derivative)
                  derivatives.append(derivative)
          # First timestamp is assigned the same derivative as the second timestamp.
          if derivatives:
              derivatives.insert(0, derivatives[0])
          self.derivatives = derivatives
docs: Compute derivatives of the time series.