code: def split(self, k):
          
          if not 1 <= k <= self.num_rows - 1:
              raise ValueError("Invalid value of k. k must be between 1 and the"
                               "number of rows - 1")
  
          rows = np.random.permutation(self.num_rows)
  
          first = self.take(rows[:k])
          rest = self.take(rows[k:])
          for column_label in self._formats:
              first._formats[column_label] = self._formats[column_label]
              rest._formats[column_label] = self._formats[column_label]
          return first, rest
docs: Return a tuple of two tables where the first table contains
          ``k`` rows randomly sampled and the second contains the remaining rows.
  
          Args:
              ``k`` (int): The number of rows randomly sampled into the first
                  table. ``k`` must be between 1 and ``num_rows - 1``.
  
          Raises:
              ``ValueError``: ``k`` is not between 1 and ``num_rows - 1``.
  
          Returns:
              A tuple containing two instances of ``Table``.
  
          >>> jobs = Table().with_columns(
          ...     'job',  make_array('a', 'b', 'c', 'd'),
          ...     'wage', make_array(10, 20, 15, 8))
          >>> jobs
          job  | wage
          a    | 10
          b    | 20
          c    | 15
          d    | 8
          >>> sample, rest = jobs.split(3)
          >>> sample # doctest: +SKIP
          job  | wage
          c    | 15
          a    | 10
          b    | 20
          >>> rest # doctest: +SKIP
          job  | wage
          d    | 8