code: def _kpoints(data, k):
      """Pick k points at random in data (one row = one observation).
  
       Parameters
       ----------
       data : ndarray
           Expect a rank 1 or 2 array. Rank 1 are assumed to describe one
           dimensional data, rank 2 multidimensional data, in which case one
           row is one observation.
       k : int
           Number of samples to generate.
  
      Returns
       -------
       x : ndarray
           A 'k' by 'N' containing the initial centroids
  
      """
      idx = np.random.choice(data.shape[0], size=k, replace=False)
      return data[idx]
  
imports: from __future__ import division, print_function, absolute_import
  import warnings
  import numpy
  from collections import deque
  from scipy._lib._util import _asarray_validated
  from scipy._lib.six import xrange
  from scipy.spatial.distance import cdist
  from .None import _vq
label_desc: Use image node_id 6 for calling a global function with example usage: _kpoints(data, k) and returns: data