code: def sample(self, percentage):
          
          if not (0.0 < percentage < 1.0):
              raise ValueError("Parameter percentage has to be in (0.0, 1.0).")
  
          cls         = self.__class__
          value_count = int(len(self) * percentage)
          values      = random.sample(self, value_count)
  
          sample      = cls.from_twodim_list(values)
          rest_values = self._timeseriesData[:]
  
          for value in values:
              rest_values.remove(value)
  
          rest = cls.from_twodim_list(rest_values)
  
          return sample, rest
docs: Samples with replacement from the TimeSeries. Returns the sample and the remaining timeseries.
          The original timeseries is not changed.
  
          :param float percentage: How many percent of the original timeseries should be in the sample
  
          :return:    A tuple containing (sample, rest) as two TimeSeries.
          :rtype: tuple(TimeSeries,TimeSeries)
  
          :raise:    Raises a ValueError if percentage is not in (0.0, 1.0).