code: def to_vector(np_array):
      
      if len(np_array.shape) == 1:
          return Vectors.dense(np_array)
      else:
          raise Exception("An MLLib Vector can only be created from a one-dimensional " +
                          "numpy array, got {}".format(len(np_array.shape)))
docs: Convert numpy array to MLlib Vector