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.nominal()
Returns a nominal scale of measure based on distinct values in the vector.static StringVector
Creates a named string vector.static StringVector
of
(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 String
toString
(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:BaseVector
Returns a new vector with selected entries. -
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.
-