Package tech.tablesaw.api
Class NumberColumn<C extends NumberColumn<C,T>,T extends Number>
java.lang.Object
tech.tablesaw.columns.AbstractColumn<C,T>
tech.tablesaw.api.NumberColumn<C,T>
- Type Parameters:
C
- The column typeT
- The (boxed) type of data in the column
- All Implemented Interfaces:
Iterable<T>
,Comparator<T>
,NumericColumn<T>
,Column<T>
,NumberFilters
,NumberMapFunctions
,FilterSpec<Selection>
,NumberFilterSpec<Selection>
- Direct Known Subclasses:
DoubleColumn
,FloatColumn
,IntColumn
,LongColumn
,ShortColumn
public abstract class NumberColumn<C extends NumberColumn<C,T>,T extends Number>
extends AbstractColumn<C,T>
implements NumericColumn<T>
An abstract class that provides a partial implementation for columns of numeric data
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final it.unimi.dsi.fastutil.ints.IntComparator
protected Locale
Fields inherited from class tech.tablesaw.columns.AbstractColumn
DEFAULT_ARRAY_SIZE, DEFAULT_COLUMN_TYPE_MISMATCH_MESSAGE
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
NumberColumn
(ColumnType type, String name, AbstractColumnParser<T> parser) -
Method Summary
Modifier and TypeMethodDescriptionabstract NumericColumn<T>
bottom
(int n) Returns the smallest ("bottom") n values in the column TODO(lwhite): Consider whether this should exclude missingint
byteSize()
Returns the width of a cell in this column, in bytes.int
Returns the count of missing values in this columnprotected abstract C
protected abstract C
Returns a copy of the receiver with no data.emptyCopy
(int rowSize) Returns an empty copy of the receiver, with its internal storage initialized to the given row size.protected NumberColumnFormatter
Returns the NumbetPrintFormatter for this column, or nullgetString
(int row) Returns a string representation of the value at the given row.it.unimi.dsi.fastutil.ints.IntComparator
Compares the given ints, which refer to the indexes of the doubles in this column, according to the values of the doubles themselvesset
(DoublePredicate condition, T newValue) Sets the value of all elements in this column matching condition to be equal to newValue and returns this columnset
(DoublePredicate condition, NumberColumn<C, T> other) Updates this column where values matching the selection are replaced with the corresponding value from the given columnvoid
setPrintFormatter
(NumberFormat format, String missingValueIndicator) Sets the print formatter to a newColumnFormatter
constructed from the given number format and missing value indicator TODO: make these return the column?void
setPrintFormatter
(NumberColumnFormatter formatter) Sets the print formatter to the argumentabstract NumericColumn<T>
top
(int n) Returns the largest ("top") n values in the column TODO(lwhite): Consider whether this should exclude missingMethods inherited from class tech.tablesaw.columns.AbstractColumn
asStringColumn, filter, first, indexOf, inRange, last, map, max, min, name, parser, sampleN, sampleX, set, set, setName, setParser, sorted, subset, toString, type
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface tech.tablesaw.columns.Column
allMatch, anyMatch, append, append, append, appendCell, appendCell, appendMissing, appendObj, asBytes, asList, asObjectArray, asSet, clear, columnWidth, contains, count, count, countUnique, equals, filter, first, get, getUnformattedString, indexOf, inRange, isMissing, last, map, map, mapInto, max, max, min, min, name, noneMatch, parser, print, reduce, reduce, removeMissing, sampleN, sampleX, set, set, set, set, set, set, setMissing, setMissingTo, setName, setParser, size, sortAscending, sortDescending, sorted, subset, title, type, unique, valueHash
Methods inherited from interface java.util.Comparator
compare, equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
Methods inherited from interface tech.tablesaw.columns.numbers.NumberFilters
isBetweenExclusive, isBetweenInclusive, isCloseTo, isEqualTo, isEqualTo, isGreaterThan, isGreaterThan, isGreaterThanOrEqualTo, isGreaterThanOrEqualTo, isLessThan, isLessThan, isLessThanOrEqualTo, isLessThanOrEqualTo, isNegative, isNonNegative, isNotEqualTo, isNotEqualTo, isPositive, isZero, size
Methods inherited from interface tech.tablesaw.columns.numbers.NumberMapFunctions
abs, add, add, add, asPercent, asRatio, bin, cube, cubeRoot, cumMax, cumMin, cumProd, cumSum, difference, divide, divide, divide, isMissing, log10, log1p, logN, multiply, multiply, multiply, name, neg, normalize, pctChange, power, power, reciprocal, remainder, remainder, round, roundInt, size, sqrt, square, subtract, subtract, subtract
Methods inherited from interface tech.tablesaw.api.NumericColumn
allMatch, anyMatch, asDoubleArray, asDoubleColumn, asFloatColumn, asIntColumn, asLongColumn, asShortColumn, asStringColumn, autoCorrelation, autoCorrelation, copy, count, count, eval, eval, geometricMean, getDouble, interpolate, isEmpty, isIn, isMissing, isNotIn, isNotMissing, kendalls, kurtosis, lag, lead, mapInto, max, max, mean, median, min, min, noneMatch, pctChange, pearsons, percentile, populationVariance, product, quadraticMean, quartile1, quartile3, range, reduce, reduce, rolling, skewness, spearmans, standardDeviation, stats, sum, summarize, summary, sumOfLogs, sumOfSquares, variance, where
-
Field Details
-
locale
-
comparator
protected final it.unimi.dsi.fastutil.ints.IntComparator comparator
-
-
Constructor Details
-
NumberColumn
-
-
Method Details
-
createCol
-
createCol
-
set
Updates this column where values matching the selection are replaced with the corresponding value from the given column -
set
Sets the value of all elements in this column matching condition to be equal to newValue and returns this column -
setPrintFormatter
Sets the print formatter to a newColumnFormatter
constructed from the given number format and missing value indicator TODO: make these return the column?- Specified by:
setPrintFormatter
in interfaceNumericColumn<C extends NumberColumn<C,
T>>
-
setPrintFormatter
Sets the print formatter to the argument- Specified by:
setPrintFormatter
in interfaceNumericColumn<C extends NumberColumn<C,
T>>
-
getPrintFormatter
Returns the NumbetPrintFormatter for this column, or null -
top
Returns the largest ("top") n values in the column TODO(lwhite): Consider whether this should exclude missing- Parameters:
n
- The maximum number of records to return. The actual number will be smaller if n is greater than the number of observations in the column- Returns:
- A list, possibly empty, of the largest observations
-
bottom
Returns the smallest ("bottom") n values in the column TODO(lwhite): Consider whether this should exclude missing- Parameters:
n
- The maximum number of records to return. The actual number will be smaller if n is greater than the number of observations in the column- Returns:
- A list, possibly empty, of the smallest n observations
-
getString
Returns a string representation of the value at the given row. -
emptyCopy
Returns a copy of the receiver with no data. The column name and type are the same. -
emptyCopy
Returns an empty copy of the receiver, with its internal storage initialized to the given row size. -
rowComparator
public it.unimi.dsi.fastutil.ints.IntComparator rowComparator()Compares the given ints, which refer to the indexes of the doubles in this column, according to the values of the doubles themselves- Specified by:
rowComparator
in interfaceColumn<C extends NumberColumn<C,
T>>
-
byteSize
public int byteSize()Returns the width of a cell in this column, in bytes. -
countMissing
public int countMissing()Returns the count of missing values in this column- Specified by:
countMissing
in interfaceColumn<C extends NumberColumn<C,
T>> - Returns:
- missing values as int
-