Interface NumericColumn<T extends Number>
-
- Type Parameters:
T-
- All Superinterfaces:
Column<T>,Comparator<T>,FilterSpec<Selection>,Iterable<T>,NumberFilters,NumberFilterSpec<Selection>,NumberMapFunctions
- All Known Implementing Classes:
DoubleColumn,FloatColumn,IntColumn,LongColumn,NumberColumn,ShortColumn
public interface NumericColumn<T extends Number> extends Column<T>, NumberMapFunctions, NumberFilters
A Column of numeric values
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default booleanallMatch(DoublePredicate test)Returns true if all rows satisfy the predicate, false otherwisedefault booleananyMatch(DoublePredicate test)Returns true if any row satisfies the predicate, false otherwisedefault double[]asDoubleArray()default DoubleColumnasDoubleColumn()Returns a new DoubleColumn containing a value for each value in this columndefault FloatColumnasFloatColumn()Returns a new FloatColumn containing a value for each value in this columndefault IntColumnasIntColumn()Returns a new IntColumn containing a value for each value in this columndefault LongColumnasLongColumn()Returns a new LongColumn containing a value for each value in this columndefault ShortColumnasShortColumn()Returns a new ShortColumn containing a value for each value in this columnStringColumnasStringColumn()Returns a StringColumn consisting of the (unformatted) String representation of this column valuesdefault doubleautoCorrelation()Returns the auto-correlation (correlation between each element and the next)default doubleautoCorrelation(int lag)Returns the auto-correlation between elements separated bylag.NumericColumn<T>copy()Returns a deep copy of the receiverdefault intcount(DoublePredicate test)Counts the number of rows satisfying predicatedefault intcount(DoublePredicate test, int max)Counts the number of rows satisfying predicate, but only upto the max valuedefault Selectioneval(BiPredicate<Number,Number> predicate, Number number)default Selectioneval(DoublePredicate predicate)default doublegeometricMean()Returns the geometric mean of the data in this columndoublegetDouble(int index)Returns a double representation of the number atindexdefault NumberInterpolator<T>interpolate()Returns aNumberInterpolatorobject that can be used to interpolate values for elements missing in the columndefault booleanisEmpty()Returns true if the column has no datadefault SelectionisIn(Collection<Number> numbers)default SelectionisMissing()Returns a selection containing an index for every missing value in this columndefault SelectionisNotIn(Collection<Number> numbers)default SelectionisNotMissing()Returns a selection containing an index for every non-missing value in this columndefault doublekendalls(NumericColumn<?> otherColumn)Returns the Kendall's Tau Rank correlation between the receiver and the otherColumndefault doublekurtosis()Returns the kurtosis of the data in this columnNumericColumn<T>lag(int n)Returns a column of the same type and size as the receiver, containing the receivers values offset by n.default NumericColumn<T>lead(int n)Returns a column of the same type as the receiver, containing the receivers values offset -n For example if you lead a column containing 2, 3, 4 by 1, you get a column containing 3, 4, NA.default <R extends Column<RT>,RT>
RmapInto(DoubleFunction<? extends RT> fun, R into)Maps the function across all rows, appending the results to the provided Columndefault doublemax()Returns the largest value in this columndefault Optional<Double>max(it.unimi.dsi.fastutil.doubles.DoubleComparator comp)Returns the maximum row according to the provided Comparatordefault doublemean()Returns the mean of the data in this columndefault doublemedian()Returns the median or 50th percentile of the data in this columndefault doublemin()Returns the smallest value in this columndefault Optional<Double>min(it.unimi.dsi.fastutil.doubles.DoubleComparator comp)Returns the minimum row according to the provided Comparatordefault booleannoneMatch(DoublePredicate test)Returns true if no row satisfies the predicate, false otherwisedefault DoubleColumnpctChange(int periods)Returns a column containing the percentage change between values that areperiodsapartdefault doublepearsons(NumericColumn<?> otherColumn)Returns the pearson's correlation between the receiver and the otherColumndefault doublepercentile(double percentile)Returns the given percentile of the data in this columndefault doublepopulationVariance()Returns the population variance of the data in this columndefault doubleproduct()Returns the product of values in this columndefault doublequadraticMean()Returns the quadraticMean, aka the root-mean-square, for all values in this columndefault doublequartile1()Returns the 1st quartile of the data in this columndefault doublequartile3()Returns the 3rd quartile of the data in this columndefault doublerange()Returns the range of the data in this columndefault doublereduce(double initial, DoubleBinaryOperator op)Reduction with binary operator and initial valuedefault Optional<Double>reduce(DoubleBinaryOperator op)Reduction with binary operatordefault NumberRollingColumnrolling(int windowSize)Returns aRollingColumnwith the given windowSize, which can be used for performing calculations on rolling subsets of my datavoidsetPrintFormatter(NumberFormat format, String missingValueIndicator)Sets the print formatter to a newColumnFormatterconstructed from the given number format and missing value indicator TODO: make these return the column?voidsetPrintFormatter(NumberColumnFormatter formatter)Sets the print formatter to the argumentdefault doubleskewness()Returns the skewness of the data in this columndefault doublespearmans(NumericColumn<?> otherColumn)Returns the Spearman's Rank correlation between the receiver and the otherColumndefault doublestandardDeviation()Returns the standard deviation of the data in this columndefault Statsstats()Returns aStatsobject that collects common statistical measures of the data in this columndefault doublesum()Returns the sum of the values in this columndefault Doublesummarize(Selection selection, NumericAggregateFunction function)Summarizes the data in this column for all rows where the current value matches the selection criteriadefault Tablesummary()Returns a table of common statistical values that together describe the data in this columndefault doublesumOfLogs()Returns the sum of logs of the data in this columndefault doublesumOfSquares()Returns the sum of squares of the data in this columndefault doublevariance()Returns the sample variance of the data in this columndefault NumericColumn<T>where(Selection selection)Returns the subset of data in this column included in the givenSelection-
Methods inherited from interface tech.tablesaw.columns.Column
allMatch, anyMatch, append, append, append, appendCell, appendCell, appendMissing, appendObj, asBytes, asList, asObjectArray, asSet, byteSize, clear, columnWidth, contains, count, count, countMissing, countUnique, emptyCopy, emptyCopy, equals, filter, first, get, getString, getUnformattedString, indexOf, inRange, isMissing, last, lastIndexOf, map, map, mapInto, max, max, min, min, name, noneMatch, parser, print, reduce, reduce, removeMissing, rowComparator, 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
-
-
-
-
Method Detail
-
isEmpty
default boolean isEmpty()
Returns true if the column has no data
-
asDoubleArray
default double[] asDoubleArray()
- Specified by:
asDoubleArrayin interfaceNumberMapFunctions
-
eval
default Selection eval(DoublePredicate predicate)
- Specified by:
evalin interfaceNumberFilters
-
eval
default Selection eval(BiPredicate<Number,Number> predicate, Number number)
- Specified by:
evalin interfaceNumberFilters
-
isIn
default Selection isIn(Collection<Number> numbers)
- Specified by:
isInin interfaceNumberFilters- Specified by:
isInin interfaceNumberFilterSpec<T extends Number>
-
isNotIn
default Selection isNotIn(Collection<Number> numbers)
- Specified by:
isNotInin interfaceNumberFilters- Specified by:
isNotInin interfaceNumberFilterSpec<T extends Number>
-
isMissing
default Selection isMissing()
Returns a selection containing an index for every missing value in this column- Specified by:
isMissingin interfaceColumn<T extends Number>- Specified by:
isMissingin interfaceFilterSpec<T extends Number>- Specified by:
isMissingin interfaceNumberFilters
-
isNotMissing
default Selection isNotMissing()
Returns a selection containing an index for every non-missing value in this column- Specified by:
isNotMissingin interfaceColumn<T extends Number>- Specified by:
isNotMissingin interfaceFilterSpec<T extends Number>- Specified by:
isNotMissingin interfaceNumberFilters
-
count
default int count(DoublePredicate test)
Counts the number of rows satisfying predicate- Parameters:
test- the predicate- Returns:
- the number of rows satisfying the predicate
-
count
default int count(DoublePredicate test, int max)
Counts the number of rows satisfying predicate, but only upto the max value- Parameters:
test- the predicatemax- the maximum number of rows to count- Returns:
- the number of rows satisfying the predicate
-
allMatch
default boolean allMatch(DoublePredicate test)
Returns true if all rows satisfy the predicate, false otherwise- Parameters:
test- the predicate- Returns:
- true if all rows satisfy the predicate, false otherwise
-
anyMatch
default boolean anyMatch(DoublePredicate test)
Returns true if any row satisfies the predicate, false otherwise- Parameters:
test- the predicate- Returns:
- true if any rows satisfies the predicate, false otherwise
-
noneMatch
default boolean noneMatch(DoublePredicate test)
Returns true if no row satisfies the predicate, false otherwise- Parameters:
test- the predicate- Returns:
- true if no row satisfies the predicate, false otherwise
-
max
default Optional<Double> max(it.unimi.dsi.fastutil.doubles.DoubleComparator comp)
Returns the maximum row according to the provided Comparator
-
min
default Optional<Double> min(it.unimi.dsi.fastutil.doubles.DoubleComparator comp)
Returns the minimum row according to the provided Comparator
-
setPrintFormatter
void setPrintFormatter(NumberFormat format, String missingValueIndicator)
Sets the print formatter to a newColumnFormatterconstructed from the given number format and missing value indicator TODO: make these return the column?
-
setPrintFormatter
void setPrintFormatter(NumberColumnFormatter formatter)
Sets the print formatter to the argument
-
reduce
default double reduce(double initial, DoubleBinaryOperator op)Reduction with binary operator and initial value- Parameters:
initial- initial valueop- the operator- Returns:
- the result of reducing initial value and all rows with operator
-
reduce
default Optional<Double> reduce(DoubleBinaryOperator op)
Reduction with binary operator- Parameters:
op- the operator- Returns:
- Optional with the result of reducing all rows with operator
-
mapInto
default <R extends Column<RT>,RT> R mapInto(DoubleFunction<? extends RT> fun, R into)
Maps the function across all rows, appending the results to the provided Column- Parameters:
fun- function to mapinto- Column to which results are appended- Returns:
- the provided Column, to which results are appended
-
where
default NumericColumn<T> where(Selection selection)
Returns the subset of data in this column included in the givenSelection
-
interpolate
default NumberInterpolator<T> interpolate()
Returns aNumberInterpolatorobject that can be used to interpolate values for elements missing in the column- Specified by:
interpolatein interfaceColumn<T extends Number>
-
summarize
default Double summarize(Selection selection, NumericAggregateFunction function)
Summarizes the data in this column for all rows where the current value matches the selection criteriaExample: myColumn.summarize(myColumn.isLessThan(100), AggregateFunctions.count);
-
sum
default double sum()
Returns the sum of the values in this column- Specified by:
sumin interfaceNumberMapFunctions
-
product
default double product()
Returns the product of values in this column
-
mean
default double mean()
Returns the mean of the data in this column
-
median
default double median()
Returns the median or 50th percentile of the data in this column
-
quartile1
default double quartile1()
Returns the 1st quartile of the data in this column
-
quartile3
default double quartile3()
Returns the 3rd quartile of the data in this column
-
percentile
default double percentile(double percentile)
Returns the given percentile of the data in this column
-
range
default double range()
Returns the range of the data in this column
-
max
default double max()
Returns the largest value in this column
-
min
default double min()
Returns the smallest value in this column
-
variance
default double variance()
Returns the sample variance of the data in this column
-
populationVariance
default double populationVariance()
Returns the population variance of the data in this column
-
standardDeviation
default double standardDeviation()
Returns the standard deviation of the data in this column
-
sumOfLogs
default double sumOfLogs()
Returns the sum of logs of the data in this column
-
sumOfSquares
default double sumOfSquares()
Returns the sum of squares of the data in this column
-
geometricMean
default double geometricMean()
Returns the geometric mean of the data in this column
-
quadraticMean
default double quadraticMean()
Returns the quadraticMean, aka the root-mean-square, for all values in this column
-
kurtosis
default double kurtosis()
Returns the kurtosis of the data in this column
-
skewness
default double skewness()
Returns the skewness of the data in this column
-
pearsons
default double pearsons(NumericColumn<?> otherColumn)
Returns the pearson's correlation between the receiver and the otherColumn
-
autoCorrelation
default double autoCorrelation()
Returns the auto-correlation (correlation between each element and the next)
-
autoCorrelation
default double autoCorrelation(int lag)
Returns the auto-correlation between elements separated bylag. If lag is 2, the correlation is computed between pairs of elements 0 and 2, 1 and 3; 2 and 4, etc.
-
spearmans
default double spearmans(NumericColumn<?> otherColumn)
Returns the Spearman's Rank correlation between the receiver and the otherColumn- Parameters:
otherColumn- A NumberColumn with no missing values- Throws:
org.apache.commons.math3.exception.NotANumberException- if either column contains any missing values
-
kendalls
default double kendalls(NumericColumn<?> otherColumn)
Returns the Kendall's Tau Rank correlation between the receiver and the otherColumn
-
summary
default Table summary()
Returns a table of common statistical values that together describe the data in this column
-
stats
default Stats stats()
Returns aStatsobject that collects common statistical measures of the data in this column
-
rolling
default NumberRollingColumn rolling(int windowSize)
Returns aRollingColumnwith the given windowSize, which can be used for performing calculations on rolling subsets of my data
-
pctChange
default DoubleColumn pctChange(int periods)
Returns a column containing the percentage change between values that areperiodsapart
-
lead
default NumericColumn<T> lead(int n)
Returns a column of the same type as the receiver, containing the receivers values offset -n For example if you lead a column containing 2, 3, 4 by 1, you get a column containing 3, 4, NA.
-
lag
NumericColumn<T> lag(int n)
Returns a column of the same type and size as the receiver, containing the receivers values offset by n.For example if you lag a column containing 2, 3, 4 by 1, you get a column containing NA, 2, 3
-
getDouble
double getDouble(int index)
Returns a double representation of the number atindex- Specified by:
getDoublein interfaceNumberFilters- Specified by:
getDoublein interfaceNumberMapFunctions
-
asLongColumn
default LongColumn asLongColumn()
Returns a new LongColumn containing a value for each value in this columnThe exact behavior when overridden depends on the type of the receiver (LongColumn, FloatColumn, etc.)
In this version, the result is a copy of the original
-
asIntColumn
default IntColumn asIntColumn()
Returns a new IntColumn containing a value for each value in this columnThe exact behavior when overridden depends on the type of the receiver (LongColumn, FloatColumn, etc.)
In this version, the result is a copy of the original
-
asFloatColumn
default FloatColumn asFloatColumn()
Returns a new FloatColumn containing a value for each value in this columnThe exact behavior when overridden depends on the type of the receiver (LongColumn, FloatColumn, etc.)
In this version, the result is a copy of the original
-
asDoubleColumn
default DoubleColumn asDoubleColumn()
Returns a new DoubleColumn containing a value for each value in this columnThe exact behavior when overridden depends on the type of the receiver (LongColumn, FloatColumn, etc.)
In this version, the result is a copy of the original
-
asShortColumn
default ShortColumn asShortColumn()
Returns a new ShortColumn containing a value for each value in this columnThe exact behavior when overridden depends on the type of the receiver (LongColumn, FloatColumn, etc.)
In this version, the result is a copy of the original
-
copy
NumericColumn<T> copy()
Returns a deep copy of the receiver
-
asStringColumn
StringColumn asStringColumn()
Returns a StringColumn consisting of the (unformatted) String representation of this column values- Specified by:
asStringColumnin interfaceColumn<T extends Number>- Returns:
- a
StringColumnbuilt using the columnColumn.getUnformattedString(int)method
-
-