Like 'ensureVector', but converts the result to 'string' dtype if necessary
342566
function ensureStringVector(values) {
  values = ensureVector(values, 'string');
  return (values.dtype !== 'string') ?
    values.toDtype('string') :
    values;
}
833066
def vectorize(self, df, column_name):
        """"""
        vec_df = df[column_name].str.join(sep='-').str.get_dummies(sep='-')
        return vec_df
1094467
def GetVectorAsNumpy(self, flags, off):
        
        offset = self.Vector(off)
        length = self.VectorLen(off) # TODO: length accounts for bytewidth, right?
        numpy_dtype = N.to_numpy_type(flags)
        return encode.GetVectorAsNumpy(numpy_dtype, self.Bytes, length, offset)
420217
def parseValue(self, value):
        """"""
        if self.isVector():
            return list(map(self._pythonType, value.split(',')))
        if self.typ == 'boolean':
            return _parseBool(value)
        return self._pythonType(value)
1141668
def _try_coerce_result(self, result):
        

        # GH12564: CategoricalBlock is 1-dim only
        # while returned results could be any dim
        if ((not is_categorical_dtype(result)) and
                isinstance(result, np.ndarray)):
            result = _block_shape(result, ndim=self.ndim)

        return result
977820
def _check_vector_update(self, tokens, new_embedding):
        """"""
        assert self._idx_to_vec is not None, '`idx_to_vec` has not been initialized.'

        if not isinstance(tokens, (list, tuple)) or len(tokens) == 1:
            assert isinstance(new_embedding, nd.NDArray) and len(new_embedding.shape) in [1, 2], \
                '`new_embedding` must be a 1-D or 2-D NDArray if `tokens` is a single token.'
            if not isinstance(tokens, (list, tuple)):
                tokens = [tokens]
            if len(new_embedding.shape) == 1:
                new_embedding = new_embedding.expand_dims(0)

        else:
            assert isinstance(new_embedding, nd.NDArray) and len(new_embedding.shape) == 2, \
                '`new_embedding` must be a 2-D NDArray if `tokens` is a list of multiple strings.'
        if self._idx_to_vec is not None:
            assert new_embedding.shape == (len(tokens), self._idx_to_vec.shape[1]), \
                'The length of `new_embedding` must be equal to the number ' \
                'of tokens and the width of new_embedding must be equal ' \
                'to the dimension of embedding of the glossary.'
        else:
            assert new_embedding.shape[0] == len(tokens), \
                'The length of `new_embedding` must be equal to the number of tokens'
        return tokens
1012089
def getvector(d,s):
    '''
    
    '''
    return np.array([d[s+"x"],d[s+"y"],d[s+"z"]]);
527199
def transform(self, X):
        """"""
        utils.validation.check_is_fitted(self, 's_')
        if self.check_input:
            utils.check_array(X, dtype=[str, np.number])
        return self.row_coordinates(X)
576926
function enforceVectorDtype(array, dtype) {
  validateDtype(dtype);
  var coerceFunc = COERCE_FUNC[dtype];

  // Coerce all elements to dtype
  for (var i = 0; i < array.length; i++) {
    array[i] = coerceFunc(array[i]);
  }

  // Construct vector
  return newVector(array, dtype);
}
265874
def strtype(self):
        """"""
        if self.kind is not None:
            return "{}({})".format(self.dtype, self.kind)
        else:
            return self.dtype
412652
def _parse_dtype(self, space):
    
    if isinstance(space, gym.spaces.Discrete):
      return tf.int32
    if isinstance(space, gym.spaces.Box):
      return tf.float32
    raise NotImplementedError()
835468
def _resolve_dtype(data_type):
    """"""
    if isinstance(data_type, _FIXED_ATOMIC):
        out = _get_atomic_dtype(data_type)
    elif isinstance(data_type, _FLEXIBLE_ATOMIC):
        out = (_get_atomic_dtype(data_type), data_type.length)
    elif isinstance(data_type, Array):
        shape = data_type.shape
        if isinstance(shape, _SEQUENCE_TYPES) and len(shape) == 1:
            # Workaround the exception `ValueError: invalid itemsize in
            # generic type tuple` when an `Array` of shape 0 or (0,) is nested
            # within another `Array`.
            shape = shape[0]

        out = (_resolve_dtype(data_type.element_type), shape)
    elif isinstance(data_type, Structure):
        out = [(field.name, _resolve_dtype(field.type))
               for field in data_type.fields]

    return out
383685
def _isstring(dtype):
    
    return dtype.type == numpy.unicode_ or dtype.type == numpy.string_
1056445
def serialize(expr):
    """"""

    result = None

    if isinstance(expr, string_types):
        result = expr

    elif expr is not None:
        result = '=py:{0}'.format(expr)

    return result
185909
def _validate_dtype(self, dtype):
        

        if dtype is not None:
            dtype = pandas_dtype(dtype)

            # a compound dtype
            if dtype.kind == 'V':
                raise NotImplementedError("compound dtypes are not implemented"
                                          " in the {0} constructor"
                                          .format(self.__class__.__name__))

        return dtype
258634
def pystr(v_str):
    """"""
    assert isinstance(v_str, str)

    if v_str[0] in ("'", '"') and v_str[0] == v_str[-1]:
        quote = v_str[0]
        out = v_str[1:-1]
    else:
        # NOTE: This is non-standard Fortran.
        #       For example, gfortran rejects non-delimited strings.
        quote = None
        out = v_str

    # Replace escaped strings
    if quote:
        out = out.replace(2 * quote, quote)

    return out
1105508
function packVector(vector, includeMetadata) {
  includeMetadata = isUndefined(includeMetadata) ? true : includeMetadata;
  var dtype = vector.dtype;
  if (vector.dtype === 'date') {
    vector = vector.toDtype('number');
  }
  var values = (vector.dtype !== 'number') ?
    vector.values.slice() :
    vector.values.map(function(x) {
      return Number.isNaN(x) ? null : x;
    });

  var result = {dtype: dtype, values: values};
  if (includeMetadata) {
    result.version = jd.version;
    result.type = vectorProto.type;
  }
  return result;
}