Class NumberVector<T extends Number>
java.lang.Object
smile.data.vector.AbstractVector
smile.data.vector.ObjectVector<T>
smile.data.vector.NumberVector<T>
- Type Parameters:
T- a subclass of Number.
- All Implemented Interfaces:
Serializable, ValueVector
A number object vector.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns a DoubleStream consisting of the elements of this vector, converted to double.voidfillna(double value) Fills null/NaN/Inf values with the specified value.Returns a new vector with selected entries.Returns an IntStream consisting of the elements of this vector, converted to integer.Returns a LongStream consisting of the elements of this vector, converted to long.doublemax()Returns the maximal value.doublemean()Returns the mean.doublemedian()Returns the median.doublemin()Returns the minimal value.doubleq1()Returns the 25% quantile.doubleq3()Returns the 75% quantile.doublestdev()Returns the standard deviation.Returns the vector with the new name.Methods inherited from class ObjectVector
distinct, get, getBoolean, getByte, getChar, getDouble, getFloat, getInt, getLong, getNullCount, getShort, isNullable, isNullAt, of, of, of, of, of, of, of, of, set, size, streamMethods inherited from class AbstractVector
field, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ValueVector
anyNull, apply, apply, dtype, eq, ge, get, getScale, getString, gt, isin, isNull, le, lt, measure, name, ne, slice, slice, toDoubleArray, toIntArray, toLongArray, toStringArray, toStringArray, update
-
Constructor Details
-
NumberVector
Constructor.- Parameters:
field- the struct field of vector.vector- the elements of vector.
-
-
Method Details
-
mean
public double mean()Returns the mean.- Returns:
- the mean.
-
stdev
public double stdev()Returns the standard deviation.- Returns:
- the standard deviation.
-
min
public double min()Returns the minimal value.- Returns:
- the minimal value.
-
max
public double max()Returns the maximal value.- Returns:
- the maximal value.
-
median
public double median()Returns the median.- Returns:
- the median.
-
q1
public double q1()Returns the 25% quantile.- Returns:
- the 25% quantile.
-
q3
public double q3()Returns the 75% quantile.- Returns:
- the 75% quantile.
-
fillna
public void fillna(double value) Fills null/NaN/Inf values with the specified value.- Parameters:
value- the value to replace NAs.
-
get
Description copied from interface:ValueVectorReturns a new vector with selected entries.- Specified by:
getin interfaceValueVector- Overrides:
getin classObjectVector<T extends Number>- Parameters:
index- the index of selected entries.- Returns:
- the new vector of selected entries.
-
withName
Description copied from interface:ValueVectorReturns the vector with the new name.- Specified by:
withNamein interfaceValueVector- Overrides:
withNamein classObjectVector<T extends Number>- Parameters:
name- the new name.- Returns:
- the vector with the new name.
-
intStream
Description copied from interface:ValueVectorReturns an IntStream consisting of the elements of this vector, converted to integer.- Returns:
- an IntStream consisting of the elements of this vector.
-
longStream
Description copied from interface:ValueVectorReturns a LongStream consisting of the elements of this vector, converted to long.- Returns:
- a LongStream consisting of the elements of this vector.
-
doubleStream
Description copied from interface:ValueVectorReturns a DoubleStream consisting of the elements of this vector, converted to double.- Returns:
- a DoubleStream consisting of the elements of this vector.
-