Package smile.data.vector
Class NullablePrimitiveVector
java.lang.Object
smile.data.vector.AbstractVector
smile.data.vector.NullablePrimitiveVector
- All Implemented Interfaces:
Serializable
,ValueVector
- Direct Known Subclasses:
NullableBooleanVector
,NullableByteVector
,NullableCharVector
,NullableDoubleVector
,NullableFloatVector
,NullableIntVector
,NullableLongVector
,NullableShortVector
Abstract base class implementation of ValueVector interface.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
fillna
(double value) Fills NaN/Inf values with the specified value.int
Returns the number of null/missing values in this vector.Returns the null bitmap mask.boolean
Returns true if the values of vector may be null.boolean
isNullAt
(int i) Returns true if the value at the given index is null/missing.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.void
setNullMask
(BitSet mask) Sets the null bitmap mask.double
stdev()
Returns the standard deviation.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, doubleStream, dtype, eq, ge, get, get, get, getBoolean, getByte, getChar, getDouble, getFloat, getInt, getLong, getScale, getShort, getString, gt, intStream, isin, isNull, le, longStream, lt, measure, name, ne, set, size, slice, slice, stream, toDoubleArray, toIntArray, toLongArray, toStringArray, toStringArray, update, withName
-
Constructor Details
-
NullablePrimitiveVector
Constructor.- Parameters:
field
- The struct field of the vector.nullMask
- The null bitmap. The bit is 1 if the value is null.
-
-
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 NaN/Inf values with the specified value.- Parameters:
value
- the value to replace NAs.
-
isNullable
public boolean isNullable()Description copied from interface:ValueVector
Returns true if the values of vector may be null.- Returns:
- true if the values of vector may be null.
-
isNullAt
public boolean isNullAt(int i) Description copied from interface:ValueVector
Returns true if the value at the given index is null/missing.- Parameters:
i
- the index.- Returns:
- true if the value at the given index is null/missing.
-
getNullCount
public int getNullCount()Description copied from interface:ValueVector
Returns the number of null/missing values in this vector.- Returns:
- the number of null/missing values in this vector.
-
setNullMask
Sets the null bitmap mask.- Parameters:
mask
- The null bitmap mask.
-
getNullMask
Returns the null bitmap mask.- Returns:
- the null bitmap mask.
-