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 Details

    • isEmpty

      default boolean isEmpty()
      Returns true if the column has no data
      Specified by:
      isEmpty in interface Column<T extends Number>
      Specified by:
      isEmpty in interface NumberMapFunctions
      Returns:
      true if empty, false if not
    • asDoubleArray

      default double[] asDoubleArray()
      Specified by:
      asDoubleArray in interface NumberMapFunctions
    • eval

      default Selection eval(DoublePredicate predicate)
      Specified by:
      eval in interface NumberFilters
    • eval

      default Selection eval(BiPredicate<Number,Number> predicate, Number number)
      Specified by:
      eval in interface NumberFilters
    • isIn

      default Selection isIn(Collection<Number> numbers)
      Specified by:
      isIn in interface NumberFilters
      Specified by:
      isIn in interface NumberFilterSpec<T extends Number>
    • isNotIn

      default Selection isNotIn(Collection<Number> numbers)
      Specified by:
      isNotIn in interface NumberFilters
      Specified by:
      isNotIn in interface NumberFilterSpec<T extends Number>
    • isMissing

      default Selection isMissing()
      Returns a selection containing an index for every missing value in this column
      Specified by:
      isMissing in interface Column<T extends Number>
      Specified by:
      isMissing in interface FilterSpec<T extends Number>
      Specified by:
      isMissing in interface NumberFilters
    • isNotMissing

      default Selection isNotMissing()
      Returns a selection containing an index for every non-missing value in this column
      Specified by:
      isNotMissing in interface Column<T extends Number>
      Specified by:
      isNotMissing in interface FilterSpec<T extends Number>
      Specified by:
      isNotMissing in interface NumberFilters
    • 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 predicate
      max - 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 new ColumnFormatter constructed 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 value
      op - 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 map
      into - 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 given Selection
      Specified by:
      where in interface Column<T extends Number>
    • interpolate

      default NumberInterpolator<T> interpolate()
      Returns a NumberInterpolator object that can be used to interpolate values for elements missing in the column
      Specified by:
      interpolate in interface Column<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 criteria

      Example: myColumn.summarize(myColumn.isLessThan(100), AggregateFunctions.count);

    • sum

      default double sum()
      Returns the sum of the values in this column
      Specified by:
      sum in interface NumberMapFunctions
    • 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 by lag. 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
      Specified by:
      summary in interface Column<T extends Number>
    • stats

      default Stats stats()
      Returns a Stats object that collects common statistical measures of the data in this column
    • rolling

      default NumberRollingColumn rolling(int windowSize)
      Returns a RollingColumn with the given windowSize, which can be used for performing calculations on rolling subsets of my data
      Specified by:
      rolling in interface Column<T extends Number>
      Parameters:
      windowSize - The number of elements to include in each calculation
      Returns:
      a RollingColumn
    • pctChange

      default DoubleColumn pctChange(int periods)
      Returns a column containing the percentage change between values that are periods apart
    • 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.
      Specified by:
      lead in interface Column<T extends Number>
    • 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

      Specified by:
      lag in interface Column<T extends Number>
    • getDouble

      double getDouble(int index)
      Returns a double representation of the number at index
      Specified by:
      getDouble in interface NumberFilters
      Specified by:
      getDouble in interface NumberMapFunctions
    • asLongColumn

      default LongColumn asLongColumn()
      Returns a new LongColumn containing a value for each value in this column

      The 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 column

      The 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 column

      The 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 column

      The 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 column

      The 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
      Specified by:
      copy in interface Column<T extends Number>
      Returns:
      a Column
    • asStringColumn

      StringColumn asStringColumn()
      Returns a StringColumn consisting of the (unformatted) String representation of this column values
      Specified by:
      asStringColumn in interface Column<T extends Number>
      Returns:
      a StringColumn built using the column Column.getUnformattedString(int) method