Package tech.tablesaw.aggregate
Class AggregateFunctions
- java.lang.Object
-
- tech.tablesaw.aggregate.AggregateFunctions
-
public class AggregateFunctions extends Object
Static utility class for pre-defined instances ofAggregateFunction
-
-
Field Summary
Fields Modifier and Type Field Description static BooleanAggregateFunction
allTrue
A function that takes a column argument and returnstrue
if all values in that column are truestatic BooleanAggregateFunction
anyTrue
A function that takes a column argument and returnstrue
if at least one value in the column is truestatic NumericAggregateFunction
change
A function that takes aNumericColumn
argument and returns the difference between the last and first itemsstatic AnyIntAggregateFunction
count
A function that takes aColumn
argument and returns the count of values in the column excluding missing values.static BooleanIntAggregateFunction
countFalse
A function that takes a column argument and returns the count offalse
values in the columnstatic AnyIntAggregateFunction
countMissing
A function that takes aNumericColumn
argument and returns the count of missing values in the columnstatic AnyIntAggregateFunction
countNonMissing
A function that takes aColumn
argument and returns the count of values in the column excluding missing valuesstatic BooleanIntAggregateFunction
countTrue
A function that takes a column argument and returns the number oftrue
values in a columnstatic AnyIntAggregateFunction
countUnique
AA function that takes aColumn
argument and returns the number of non-missing unique values in the columnstatic AnyIntAggregateFunction
countWithMissing
A function that takes aColumn
argument and returns the number of values in the column, including missing valuesstatic NumericAggregateFunction
cv
A function that takes aNumericColumn
argument and returns the coefficient of variation (stdDev/mean) of the values in the columnstatic DateAggregateFunction
earliestDate
A function that takes a column argument and returns the earliest date in that columnstatic DateTimeAggregateFunction
earliestDateTime
A function that takes a column argument and returns the earliest date-time value in that columnstatic NumericAggregateFunction
first
A function that takes aNumericColumn
argument and returns the first item without sortingstatic NumericAggregateFunction
geometricMean
A function that takes aNumericColumn
argument and returns the geometric mean of all values in the columnstatic NumericAggregateFunction
kurtosis
A function that takes aNumericColumn
argument and returns the kurtosis of its valuesstatic NumericAggregateFunction
last
A function that takes aNumericColumn
argument and returns the last item without sortingstatic DateAggregateFunction
latestDate
A function that takes a column argument and returns the latest date in that columnstatic DateTimeAggregateFunction
latestDateTime
A function that takes a column argument and returns the latest date-time value in that columnstatic NumericAggregateFunction
max
A function that takes aNumericColumn
argument and returns the largeset value in the columnstatic InstantAggregateFunction
maxInstant
A function that takes a column argument and returns the latest instant in that columnstatic NumericAggregateFunction
mean
A function that takes aNumericColumn
argument and returns the mean of the values in the columnstatic NumericAggregateFunction
median
A function that takes aNumericColumn
argument and returns the median of the values in the columnstatic NumericAggregateFunction
min
A function that takes aNumericColumn
argument and returns the smallest value in the columnstatic InstantAggregateFunction
minInstant
A function that takes a column argument and returns the earliest Instant in that columnstatic BooleanAggregateFunction
noneTrue
A function that takes a column argument and returnstrue
if no values in the column are truestatic NumericAggregateFunction
pctChange
A function that takes aNumericColumn
argument and returns the percent difference between the last and first itemsstatic NumericAggregateFunction
percentile90
A function that takes aNumericColumn
argument and returns the 90th percentile of the values in the columnstatic NumericAggregateFunction
percentile95
A function that takes aNumericColumn
argument and returns the 95th percentile of the values in the columnstatic NumericAggregateFunction
percentile99
A function that takes aNumericColumn
argument and returns the 99th percentile of the values in the columnstatic NumericAggregateFunction
populationVariance
A function that takes aNumericColumn
argument and returns the population variance of all values in the columnstatic NumericAggregateFunction
product
A function that takes aNumericColumn
argument and returns the product of all values in the columnstatic BooleanDoubleAggregateFunction
proportionFalse
A function that takes a column argument and returns the proportion of values in the column that arefalse
static BooleanDoubleAggregateFunction
proportionTrue
A function that takes a column argument and returns the proportion of values in that column that aretrue
static NumericAggregateFunction
quadraticMean
A function that takes aNumericColumn
argument and returns the quadratic mean, aka, the root-mean-squarestatic NumericAggregateFunction
quartile1
A function that takes aNumericColumn
argument and returns the first quartile of the values in the columnstatic NumericAggregateFunction
quartile3
A function that takes aNumericColumn
argument and returns the third quartile of the values in the columnstatic NumericAggregateFunction
range
A function that takes aNumericColumn
argument and returns the difference between the largest and smallest values in the columnstatic NumericAggregateFunction
skewness
A function that takes aNumericColumn
argument and returns the skewness of its valuesstatic NumericAggregateFunction
stdDev
A function that takes aNumericColumn
argument and returns the standard deviation of its valuesstatic NumericAggregateFunction
sum
A function that takes aNumericColumn
argument and returns the sum of the values in the columnstatic NumericAggregateFunction
sumOfLogs
A function that takes aNumericColumn
argument and returns the sumOfLogs of its valuesstatic NumericAggregateFunction
sumOfSquares
A function that takes aNumericColumn
argument and returns the sumOfSquares of its valuesstatic NumericAggregateFunction
variance
A function that takes aNumericColumn
argument and returns the variance of its values
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Double
meanDifference(NumericColumn<?> column1, NumericColumn<?> column2)
Returns the given mean difference of the values in the arguments
TODO(lwhite): These are two column reductions.static Double
percentile(NumericColumn<?> data, Double percentile)
Returns the given percentile of the values in the argumentstatic Double
sumDifference(NumericColumn<?> column1, NumericColumn<?> column2)
Returns the given sum difference of the values in the arguments
TODO(lwhite): These are two column reductions.
-
-
-
Field Detail
-
earliestDateTime
public static final DateTimeAggregateFunction earliestDateTime
A function that takes a column argument and returns the earliest date-time value in that column
-
earliestDate
public static final DateAggregateFunction earliestDate
A function that takes a column argument and returns the earliest date in that column
-
latestDate
public static final DateAggregateFunction latestDate
A function that takes a column argument and returns the latest date in that column
-
latestDateTime
public static final DateTimeAggregateFunction latestDateTime
A function that takes a column argument and returns the latest date-time value in that column
-
maxInstant
public static final InstantAggregateFunction maxInstant
A function that takes a column argument and returns the latest instant in that column
-
minInstant
public static final InstantAggregateFunction minInstant
A function that takes a column argument and returns the earliest Instant in that column
-
countTrue
public static final BooleanIntAggregateFunction countTrue
A function that takes a column argument and returns the number oftrue
values in a column
-
allTrue
public static final BooleanAggregateFunction allTrue
A function that takes a column argument and returnstrue
if all values in that column are true
-
anyTrue
public static final BooleanAggregateFunction anyTrue
A function that takes a column argument and returnstrue
if at least one value in the column is true
-
noneTrue
public static final BooleanAggregateFunction noneTrue
A function that takes a column argument and returnstrue
if no values in the column are true
-
countFalse
public static final BooleanIntAggregateFunction countFalse
A function that takes a column argument and returns the count offalse
values in the column
-
proportionTrue
public static final BooleanDoubleAggregateFunction proportionTrue
A function that takes a column argument and returns the proportion of values in that column that aretrue
-
proportionFalse
public static final BooleanDoubleAggregateFunction proportionFalse
A function that takes a column argument and returns the proportion of values in the column that arefalse
-
first
public static final NumericAggregateFunction first
A function that takes aNumericColumn
argument and returns the first item without sorting
-
last
public static final NumericAggregateFunction last
A function that takes aNumericColumn
argument and returns the last item without sorting
-
change
public static final NumericAggregateFunction change
A function that takes aNumericColumn
argument and returns the difference between the last and first items
-
pctChange
public static final NumericAggregateFunction pctChange
A function that takes aNumericColumn
argument and returns the percent difference between the last and first items
-
countNonMissing
public static final AnyIntAggregateFunction countNonMissing
A function that takes aColumn
argument and returns the count of values in the column excluding missing values
-
count
public static final AnyIntAggregateFunction count
A function that takes aColumn
argument and returns the count of values in the column excluding missing values. A synonym for countNonMissing
-
countMissing
public static final AnyIntAggregateFunction countMissing
A function that takes aNumericColumn
argument and returns the count of missing values in the column
-
countUnique
public static final AnyIntAggregateFunction countUnique
AA function that takes aColumn
argument and returns the number of non-missing unique values in the column
-
mean
public static final NumericAggregateFunction mean
A function that takes aNumericColumn
argument and returns the mean of the values in the column
-
cv
public static final NumericAggregateFunction cv
A function that takes aNumericColumn
argument and returns the coefficient of variation (stdDev/mean) of the values in the column
-
sum
public static final NumericAggregateFunction sum
A function that takes aNumericColumn
argument and returns the sum of the values in the column
-
median
public static final NumericAggregateFunction median
A function that takes aNumericColumn
argument and returns the median of the values in the column
-
countWithMissing
public static final AnyIntAggregateFunction countWithMissing
A function that takes aColumn
argument and returns the number of values in the column, including missing values
-
quartile1
public static final NumericAggregateFunction quartile1
A function that takes aNumericColumn
argument and returns the first quartile of the values in the column
-
quartile3
public static final NumericAggregateFunction quartile3
A function that takes aNumericColumn
argument and returns the third quartile of the values in the column
-
percentile90
public static final NumericAggregateFunction percentile90
A function that takes aNumericColumn
argument and returns the 90th percentile of the values in the column
-
percentile95
public static final NumericAggregateFunction percentile95
A function that takes aNumericColumn
argument and returns the 95th percentile of the values in the column
-
percentile99
public static final NumericAggregateFunction percentile99
A function that takes aNumericColumn
argument and returns the 99th percentile of the values in the column
-
range
public static final NumericAggregateFunction range
A function that takes aNumericColumn
argument and returns the difference between the largest and smallest values in the column
-
min
public static final NumericAggregateFunction min
A function that takes aNumericColumn
argument and returns the smallest value in the column
-
max
public static final NumericAggregateFunction max
A function that takes aNumericColumn
argument and returns the largeset value in the column
-
product
public static final NumericAggregateFunction product
A function that takes aNumericColumn
argument and returns the product of all values in the column
-
geometricMean
public static final NumericAggregateFunction geometricMean
A function that takes aNumericColumn
argument and returns the geometric mean of all values in the column
-
populationVariance
public static final NumericAggregateFunction populationVariance
A function that takes aNumericColumn
argument and returns the population variance of all values in the column
-
quadraticMean
public static final NumericAggregateFunction quadraticMean
A function that takes aNumericColumn
argument and returns the quadratic mean, aka, the root-mean-square
-
kurtosis
public static final NumericAggregateFunction kurtosis
A function that takes aNumericColumn
argument and returns the kurtosis of its values
-
skewness
public static final NumericAggregateFunction skewness
A function that takes aNumericColumn
argument and returns the skewness of its values
-
sumOfSquares
public static final NumericAggregateFunction sumOfSquares
A function that takes aNumericColumn
argument and returns the sumOfSquares of its values
-
sumOfLogs
public static final NumericAggregateFunction sumOfLogs
A function that takes aNumericColumn
argument and returns the sumOfLogs of its values
-
variance
public static final NumericAggregateFunction variance
A function that takes aNumericColumn
argument and returns the variance of its values
-
stdDev
public static final NumericAggregateFunction stdDev
A function that takes aNumericColumn
argument and returns the standard deviation of its values
-
-
Method Detail
-
percentile
public static Double percentile(NumericColumn<?> data, Double percentile)
Returns the given percentile of the values in the argument
-
meanDifference
public static Double meanDifference(NumericColumn<?> column1, NumericColumn<?> column2)
Returns the given mean difference of the values in the arguments
TODO(lwhite): These are two column reductions. We need a class for that
-
sumDifference
public static Double sumDifference(NumericColumn<?> column1, NumericColumn<?> column2)
Returns the given sum difference of the values in the arguments
TODO(lwhite): These are two column reductions. We need a class for that
-
-