Package smile.data.vector
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.void
fillna
(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.double
max()
Returns the maximal value.double
mean()
Returns the mean.double
median()
Returns the median.double
min()
Returns the minimal value.double
q1()
Returns the 25% quantile.double
q3()
Returns the 75% quantile.double
stdev()
Returns the standard deviation.Returns the vector with the new name.Methods inherited from class smile.data.vector.ObjectVector
distinct, get, getBoolean, getByte, getChar, getDouble, getFloat, getInt, getLong, getNullCount, getShort, isNullable, isNullAt, of, of, of, of, of, of, of, of, set, size, stream
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, 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. -
stdev
public double stdev()Returns the standard deviation. -
min
public double min()Returns the minimal value. -
max
public double max()Returns the maximal value. -
median
public double median()Returns the median. -
q1
public double q1()Returns the 25% quantile. -
q3
public double q3()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:ValueVector
Returns a new vector with selected entries.- Specified by:
get
in interfaceValueVector
- Overrides:
get
in classObjectVector<T extends Number>
- Parameters:
index
- the index of selected entries.- Returns:
- the new vector of selected entries.
-
withName
Description copied from interface:ValueVector
Returns the vector with the new name.- Specified by:
withName
in interfaceValueVector
- Overrides:
withName
in classObjectVector<T extends Number>
- Parameters:
name
- the new name.- Returns:
- the vector with the new name.
-
intStream
Description copied from interface:ValueVector
Returns 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:ValueVector
Returns 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:ValueVector
Returns a DoubleStream consisting of the elements of this vector, converted to double.- Returns:
- a DoubleStream consisting of the elements of this vector.
-