Package smile.data.vector
Class FloatVector
java.lang.Object
smile.data.vector.AbstractVector
smile.data.vector.PrimitiveVector
smile.data.vector.FloatVector
- All Implemented Interfaces:
Serializable
,ValueVector
A float vector.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionFloatVector
(String name, float[] vector) Constructor.FloatVector
(StructField field, float[] vector) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionReturns a DoubleStream consisting of the elements of this vector, converted to double.void
fillna
(float value) Fills NaN/Inf values with the specified value.get
(int i) Returns the value at position i, which may be null.Returns a new vector with selected entries.boolean
getBoolean
(int i) Returns the boolean value at position i.byte
getByte
(int i) Returns the byte value at position i.char
getChar
(int i) Returns the character value at position i.double
getDouble
(int i) Returns the double value at position i.float
getFloat
(int i) Returns the float value at position i.int
getInt
(int i) Returns the integer value at position i.long
getLong
(int i) Returns the long value at position i.short
getShort
(int i) Returns the short value at position i.boolean
isNullAt
(int i) Returns true if the value at the given index is null/missing.void
Sets the value at position i.int
size()
Returns the number of elements in the vector.Returns the vector with the new name.Methods inherited from class smile.data.vector.PrimitiveVector
getNullCount, isNullable, max, mean, median, min, q1, q3, stdev
Methods inherited from class smile.data.vector.AbstractVector
field, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface smile.data.vector.ValueVector
anyNull, apply, apply, dtype, eq, ge, get, getScale, getString, gt, intStream, isin, isNull, le, longStream, lt, measure, name, ne, slice, slice, stream, toDoubleArray, toIntArray, toLongArray, toStringArray, toStringArray, update
-
Constructor Details
-
FloatVector
Constructor.- Parameters:
name
- the name of vector.vector
- the elements of vector.
-
FloatVector
Constructor.- Parameters:
field
- the struct field of vector.vector
- the elements of vector.
-
-
Method Details
-
fillna
public void fillna(float value) Fills NaN/Inf values with the specified value.- Parameters:
value
- the value to replace NAs.
-
size
public int size()Description copied from interface:ValueVector
Returns the number of elements in the vector.- Returns:
- the number of elements in the vector.
-
withName
Description copied from interface:ValueVector
Returns the vector with the new name.- Parameters:
name
- the new name.- Returns:
- the vector with the new name.
-
doubleStream
Description copied from interface:ValueVector
Returns a DoubleStream consisting of the elements of this vector, converted to double.- Returns:
- a DoubleStream consisting of the elements of this vector.
-
set
Description copied from interface:ValueVector
Sets the value at position i.- Parameters:
i
- the index.value
- the new value.
-
get
Description copied from interface:ValueVector
Returns a new vector with selected entries.- Parameters:
index
- the index of selected entries.- Returns:
- the new vector of selected entries.
-
isNullAt
public boolean isNullAt(int i) Description copied from interface:ValueVector
Returns true if the value at the given index is null/missing.- Specified by:
isNullAt
in interfaceValueVector
- Overrides:
isNullAt
in classPrimitiveVector
- Parameters:
i
- the index.- Returns:
- true if the value at the given index is null/missing.
-
get
Description copied from interface:ValueVector
Returns the value at position i, which may be null.- Parameters:
i
- the index.- Returns:
- the value.
-
getFloat
public float getFloat(int i) Description copied from interface:ValueVector
Returns the float value at position i.- Parameters:
i
- the index.- Returns:
- the value.
-
getBoolean
public boolean getBoolean(int i) Description copied from interface:ValueVector
Returns the boolean value at position i.- Parameters:
i
- the index.- Returns:
- the value.
-
getChar
public char getChar(int i) Description copied from interface:ValueVector
Returns the character value at position i.- Parameters:
i
- the index.- Returns:
- the value.
-
getByte
public byte getByte(int i) Description copied from interface:ValueVector
Returns the byte value at position i.- Parameters:
i
- the index.- Returns:
- the value.
-
getShort
public short getShort(int i) Description copied from interface:ValueVector
Returns the short value at position i.- Parameters:
i
- the index.- Returns:
- the value.
-
getInt
public int getInt(int i) Description copied from interface:ValueVector
Returns the integer value at position i.- Parameters:
i
- the index.- Returns:
- the value.
-
getLong
public long getLong(int i) Description copied from interface:ValueVector
Returns the long value at position i.- Parameters:
i
- the index.- Returns:
- the value.
-
getDouble
public double getDouble(int i) Description copied from interface:ValueVector
Returns the double value at position i.- Parameters:
i
- the index.- Returns:
- the value.
-