Package smile.data.vector
Interface StringVector
- All Superinterfaces:
BaseVector<String,,String, Stream<String>> Serializable,Vector<String>
An immutable string vector.
-
Method Summary
Modifier and TypeMethodDescriptionfactorize(CategoricalMeasure scale) Converts strings to discrete measured values.get(int... index) Returns a new vector with selected entries.default booleangetBoolean(int i) Returns the boolean value at position i.default bytegetByte(int i) Returns the byte value at position i.default chargetChar(int i) Returns the character value at position i.default doublegetDouble(int i) Returns the double value at position i.default floatgetFloat(int i) Returns the float value at position i.default intgetInt(int i) Returns the integer value at position i.default longgetLong(int i) Returns the long value at position i.default shortgetShort(int i) Returns the short value at position i.nominal()Returns a nominal scale of measure based on distinct values in the vector.static StringVectorCreates a named string vector.static StringVectorof(StructField field, String... vector) Creates a named string vector.Returns a vector of LocalDate.toDate(DateTimeFormatter format) Returns a vector of LocalDate.default Vector<LocalDateTime> toDateTime(String pattern) Returns a vector of LocalDateTime.toDateTime(DateTimeFormatter format) Returns a vector of LocalDateTime.default StringtoString(int n) Returns the string representation of vector.Returns a vector of LocalTime.toTime(DateTimeFormatter format) Returns a vector of LocalDate.Methods inherited from interface smile.data.vector.BaseVector
apply, apply, array, field, get, measure, name, size, stream, toDoubleArray, toDoubleArray, toIntArray, toIntArray, toStringArray, toStringArray, type
-
Method Details
-
get
Description copied from interface:BaseVectorReturns a new vector with selected entries. -
getBoolean
default boolean getBoolean(int i) Description copied from interface:BaseVectorReturns the boolean value at position i.- Specified by:
getBooleanin interfaceBaseVector<String,String, Stream<String>> - Specified by:
getBooleanin interfaceVector<String>- Parameters:
i- the index.- Returns:
- the value.
-
getChar
default char getChar(int i) Description copied from interface:BaseVectorReturns the character value at position i. -
getByte
default byte getByte(int i) Description copied from interface:BaseVectorReturns the byte value at position i. -
getShort
default short getShort(int i) Description copied from interface:BaseVectorReturns the short value at position i. -
getInt
default int getInt(int i) Description copied from interface:BaseVectorReturns the integer value at position i. -
getLong
default long getLong(int i) Description copied from interface:BaseVectorReturns the long value at position i. -
getFloat
default float getFloat(int i) Description copied from interface:BaseVectorReturns the float value at position i. -
getDouble
default double getDouble(int i) Description copied from interface:BaseVectorReturns the double value at position i. -
toDate
Returns a vector of LocalDate. This method assumes that this is a string vector and uses the given date format pattern to parse strings.- Parameters:
pattern- the datetime formatter pattern.- Returns:
- the date vector.
-
toDate
Returns a vector of LocalDate. This method assumes that this is a string vector and uses the given date format pattern to parse strings.- Parameters:
format- the datetime formatter.- Returns:
- the date vector.
-
toTime
Returns a vector of LocalTime. This method assumes that this is a string vector and uses the given time format pattern to parse strings.- Parameters:
pattern- the datetime formatter pattern.- Returns:
- the time vector.
-
toTime
Returns a vector of LocalDate. This method assumes that this is a string vector and uses the given time format pattern to parse strings.- Parameters:
format- the datetime formatter.- Returns:
- the time vector.
-
toDateTime
Returns a vector of LocalDateTime. This method assumes that this is a string vector and uses the given date time format pattern to parse strings.- Parameters:
pattern- the datetime formatter pattern.- Returns:
- the datetime vector.
-
toDateTime
Returns a vector of LocalDateTime. This method assumes that this is a string vector and uses the given date time format pattern to parse strings.- Parameters:
format- the datetime formatter.- Returns:
- the datetime vector.
-
nominal
NominalScale nominal()Returns a nominal scale of measure based on distinct values in the vector.- Returns:
- the nominal scale.
-
factorize
Converts strings to discrete measured values. Depending on how many levels in the nominal scale, the type of returned vector may be byte, short or integer. The missing values/nulls will be converted to -1.- Parameters:
scale- the categorical measure.- Returns:
- the factorized vector.
-
toString
Returns the string representation of vector. -
of
Creates a named string vector.- Parameters:
name- the name of vector.vector- the data of vector.- Returns:
- the vector.
-
of
Creates a named string vector.- Parameters:
field- the struct field of vector.vector- the data of vector.- Returns:
- the vector.
-