public class DoubleColumn extends AbstractColumn<Double> implements NumberColumn
DEFAULT_ARRAY_SIZE
MISSING_VALUE
Modifier and Type | Method and Description |
---|---|
boolean |
allMatch(DoublePredicate test)
Returns true if all rows satisfy the predicate, false otherwise
|
boolean |
anyMatch(DoublePredicate test)
Returns true if any row satisfies the predicate, false otherwise
|
DoubleColumn |
append(Column<Double> column) |
DoubleColumn |
append(double d)
Adds the given double to this column
|
DoubleColumn |
append(Double val) |
DoubleColumn |
append(float f)
Adds the given float to this column
|
NumberColumn |
append(int i) |
DoubleColumn |
append(Integer val) |
DoubleColumn |
appendCell(String object) |
DoubleColumn |
appendCell(String object,
StringParser<?> parser) |
DoubleColumn |
appendMissing()
Appends a missing value appropriate to the column
|
DoubleColumn |
appendObj(Object obj) |
byte[] |
asBytes(int rowNumber)
Returns the contents of the cell at rowNumber as a byte[]
|
DateTimeColumn |
asDateTimes(ZoneOffset offset)
Returns a DateTimeColumn where each value is the LocalDateTime represented by the values in this column
The values in this column must be longs that represent the time in milliseconds from the epoch as in standard
Java date/time calculations
|
double[] |
asDoubleArray() |
int[] |
asIntArray() |
it.unimi.dsi.fastutil.ints.IntSet |
asIntegerSet() |
Object[] |
asObjectArray() |
it.unimi.dsi.fastutil.doubles.DoubleSet |
asSet() |
it.unimi.dsi.fastutil.doubles.DoubleArrayList |
bottom(int n)
Returns the smallest ("bottom") n values in the column
TODO(lwhite): Consider whether this should exclude missing
|
int |
byteSize()
Returns the width of a cell in this column, in bytes.
|
void |
clear() |
int |
compare(Double o1,
Double o2) |
boolean |
contains(double value) |
DoubleColumn |
copy()
Returns a deep copy of the receiver
|
int |
count(DoublePredicate test)
Counts the number of rows satisfying predicate
|
int |
count(DoublePredicate test,
int max)
Counts the number of rows satisfying predicate, but only upto the max value
|
static DoubleColumn |
create(String columnName) |
static DoubleColumn |
create(String name,
double[] arr) |
static DoubleColumn |
create(String name,
float[] arr) |
static DoubleColumn |
create(String name,
int initialSize) |
static DoubleColumn |
create(String name,
int[] arr) |
static DoubleColumn |
create(String name,
List<Number> numberList) |
static DoubleColumn |
create(String name,
long[] arr) |
static DoubleColumn |
create(String name,
Number[] numbers) |
it.unimi.dsi.fastutil.doubles.DoubleList |
dataInternal()
Returns a clone of the internal data structure
|
it.unimi.dsi.fastutil.doubles.DoubleIterator |
doubleIterator() |
DoubleColumn |
emptyCopy()
Returns a copy of the receiver with no data.
|
DoubleColumn |
emptyCopy(int rowSize)
Returns an empty copy of the receiver, with its internal storage initialized to the given row size.
|
Selection |
eval(BiPredicate<Number,Number> predicate,
Number number) |
Selection |
eval(DoubleBiPredicate predicate,
Number number) |
Selection |
eval(DoubleBiPredicate predicate,
NumberColumn otherColumn) |
Selection |
eval(DoublePredicate predicate) |
Selection |
eval(DoubleRangePredicate predicate,
Number rangeStart,
Number rangeEnd) |
DoubleColumn |
fillWith(it.unimi.dsi.fastutil.doubles.DoubleIterable iterable) |
DoubleColumn |
fillWith(it.unimi.dsi.fastutil.doubles.DoubleIterator iterator) |
DoubleColumn |
fillWith(DoubleSupplier supplier) |
DoubleColumn |
filter(DoublePredicate test)
Returns a new DoubleColumn with only those rows satisfying the predicate
|
double |
firstElement() |
Double |
get(int index) |
double |
getDouble(int row)
Returns a double representation of the value at the given row.
|
long |
getLong(int i)
Returns the value of the ith element rounded to the nearest long
|
String |
getString(int row)
Returns a string representation of the value at the given row.
|
String |
getUnformattedString(int row) |
static DoubleColumn |
indexColumn(String columnName,
int size,
int startsWith)
Returns a new numeric column initialized with the given name and size.
|
boolean |
isEmpty()
Returns true if the column has no data
|
Selection |
isIn(double... doubles) |
Selection |
isIn(Number... numbers) |
boolean |
isMissing(int rowNumber) |
Selection |
isNotIn(double... doubles) |
Selection |
isNotIn(Number... numbers) |
Iterator<Double> |
iterator() |
DoubleColumn |
lag(int n)
Returns a column of the same type and size as the receiver, containing the receivers values offset by n.
|
DoubleColumn |
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.
|
DoubleColumn |
map(ToDoubleFunction<Double> fun)
Maps the function across all rows, appending the results to a new DoubleColumn
|
<R> Column<R> |
mapInto(DoubleFunction<? extends R> fun,
Column<R> into)
Maps the function across all rows, appending the results to the provided Column
|
Optional<Double> |
max(it.unimi.dsi.fastutil.doubles.DoubleComparator comp)
Returns the maximum row according to the provided Comparator
|
Optional<Double> |
min(it.unimi.dsi.fastutil.doubles.DoubleComparator comp)
Returns the minimum row according to the provided Comparator
|
boolean |
noneMatch(DoublePredicate test)
Returns true if no row satisfies the predicate, false otherwise
|
Optional<Double> |
reduce(DoubleBinaryOperator op)
Reduction with binary operator
|
double |
reduce(double initial,
DoubleBinaryOperator op)
Reduction with binary operator and initial value
|
DoubleColumn |
removeMissing() |
Integer |
roundInt(int i)
Returns the rounded value as an int
|
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
|
DoubleColumn |
set(int r,
double value) |
DoubleColumn |
set(int i,
Double val) |
DoubleColumn |
set(Selection rowSelection,
double newValue)
Conditionally update this column, replacing current values with newValue for all rows where the current value
matches the selection criteria
|
void |
setPrintFormatter(NumberColumnFormatter formatter) |
void |
setPrintFormatter(NumberFormat format,
String missingValueString) |
int |
size() |
void |
sortAscending() |
void |
sortDescending() |
Stats |
stats() |
Table |
summary() |
it.unimi.dsi.fastutil.doubles.DoubleArrayList |
top(int n)
Returns the largest ("top") n values in the column
TODO(lwhite): Consider whether this should exclude missing
|
DoubleColumn |
unique()
Returns a column of the same type as the receiver, containing only the unique values of the receiver.
|
DoubleColumn |
where(Selection selection) |
name, setName, toString, type
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
countMissing, countUnique, geometricMean, isMissing, isNotMissing, kendalls, kurtosis, max, mean, median, min, pearsons, percentile, populationVariance, product, quadraticMean, quartile1, quartile3, range, rolling, skewness, spearmans, standardDeviation, sum, summarizeIf, sumOfLogs, sumOfSquares, valueIsMissing, variance
abs, add, add, add, asPercent, asRatio, bin, cube, cubeRoot, cumProd, cumSum, difference, divide, divide, divide, log10, log1p, logN, multiply, multiply, multiply, name, neg, normalize, pctChange, power, remainder, round, roundInt, sqrt, square, subtract, subtract, subtract
isBetweenExclusive, isBetweenInclusive, isCloseTo, isEqualTo, isEqualTo, isGreaterThan, isGreaterThan, isGreaterThanOrEqualTo, isGreaterThanOrEqualTo, isLessThan, isLessThan, isLessThanOrEqualTo, isLessThanOrEqualTo, isNegative, isNonNegative, isNotEqualTo, isNotEqualTo, isPositive, isZero
countByCategory
allMatch, anyMatch, asList, columnWidth, contains, count, count, fillMissing, fillMissing, filter, first, inRange, last, map, mapInto, max, max, min, min, name, noneMatch, print, reduce, reduce, rows, sampleN, sampleX, setName, sorted, subset, title, type
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public static DoubleColumn create(String name, int initialSize)
public static DoubleColumn create(String name, double[] arr)
public static DoubleColumn create(String name, float[] arr)
public static DoubleColumn create(String name, int[] arr)
public static DoubleColumn create(String name, long[] arr)
public static DoubleColumn create(String name, List<Number> numberList)
public static DoubleColumn create(String name, Number[] numbers)
public DoubleColumn removeMissing()
removeMissing
in interface Column<Double>
public static DoubleColumn indexColumn(String columnName, int size, int startsWith)
public static DoubleColumn create(String columnName)
public boolean isMissing(int rowNumber)
isMissing
in interface NumberColumn
isMissing
in interface Column<Double>
public void setPrintFormatter(NumberFormat format, String missingValueString)
setPrintFormatter
in interface NumberColumn
public DoubleColumn appendMissing()
Column
appendMissing
in interface NumberColumn
appendMissing
in interface Column<Double>
public void setPrintFormatter(NumberColumnFormatter formatter)
setPrintFormatter
in interface NumberColumn
public int size()
size
in interface NumberColumn
size
in interface Column<Double>
size
in interface NumberMapFunctions
public Table summary()
summary
in interface NumberColumn
summary
in interface Column<Double>
public Stats stats()
stats
in interface NumberColumn
public it.unimi.dsi.fastutil.doubles.DoubleArrayList top(int n)
top
in interface NumberColumn
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 columnpublic it.unimi.dsi.fastutil.doubles.DoubleArrayList bottom(int n)
bottom
in interface NumberColumn
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 columnpublic DoubleColumn unique()
Column
public double firstElement()
firstElement
in interface NumberColumn
public DoubleColumn append(float f)
append
in interface NumberColumn
public DoubleColumn append(double d)
append
in interface NumberColumn
public NumberColumn append(int i)
append
in interface NumberColumn
public DoubleColumn appendObj(Object obj)
public String getString(int row)
Column
getString
in interface NumberColumn
getString
in interface Column<Double>
row
- The index of the row.public double getDouble(int row)
Column
getDouble
in interface NumberColumn
getDouble
in interface Column<Double>
getDouble
in interface NumberMapFunctions
row
- The index of the row.public String getUnformattedString(int row)
getUnformattedString
in interface NumberColumn
getUnformattedString
in interface Column<Double>
public DoubleColumn emptyCopy()
Column
emptyCopy
in interface NumberColumn
emptyCopy
in interface Column<Double>
emptyCopy
in class AbstractColumn<Double>
Column
public DoubleColumn append(Double val)
public DoubleColumn append(Integer val)
public DoubleColumn emptyCopy(int rowSize)
Column
public DoubleColumn lead(int n)
Column
public DoubleColumn lag(int n)
Column
For example if you lag a column containing 2, 3, 4 by 1, you get a column containing NA, 2, 3
public DoubleColumn copy()
Column
public void clear()
clear
in interface NumberColumn
clear
in interface Column<Double>
public void sortAscending()
sortAscending
in interface NumberColumn
sortAscending
in interface Column<Double>
public void sortDescending()
sortDescending
in interface NumberColumn
sortDescending
in interface Column<Double>
public boolean isEmpty()
Column
isEmpty
in interface NumberColumn
isEmpty
in interface Column<Double>
isEmpty
in interface NumberMapFunctions
public DoubleColumn appendCell(String object)
appendCell
in interface NumberColumn
appendCell
in interface Column<Double>
public DoubleColumn appendCell(String object, StringParser<?> parser)
appendCell
in interface Column<Double>
public Integer roundInt(int i)
roundInt
in interface NumberColumn
ClassCastException
- if the returned value will not fit in an intpublic long getLong(int i)
getLong
in interface NumberColumn
i
- the index in the columnpublic it.unimi.dsi.fastutil.ints.IntComparator rowComparator()
rowComparator
in interface NumberColumn
rowComparator
in interface Column<Double>
public DoubleColumn set(int r, double value)
set
in interface NumberColumn
public DoubleColumn set(int i, Double val)
public DoubleColumn set(Selection rowSelection, double newValue)
Example: myColumn.set(4.0, myColumn.valueIsMissing()); // no more missing values
set
in interface NumberColumn
public double[] asDoubleArray()
asDoubleArray
in interface NumberColumn
asDoubleArray
in interface Column<Double>
asDoubleArray
in interface NumberMapFunctions
public DoubleColumn append(Column<Double> column)
public it.unimi.dsi.fastutil.doubles.DoubleIterator doubleIterator()
doubleIterator
in interface DoubleIterable
public DoubleColumn where(Selection selection)
where
in interface NumberColumn
where
in interface Column<Double>
public Selection eval(DoublePredicate predicate)
eval
in interface NumberColumn
eval
in interface NumberFilters
public Selection eval(DoubleBiPredicate predicate, NumberColumn otherColumn)
eval
in interface NumberColumn
eval
in interface NumberFilters
public Selection eval(DoubleBiPredicate predicate, Number number)
eval
in interface NumberColumn
eval
in interface NumberFilters
public Selection eval(BiPredicate<Number,Number> predicate, Number number)
eval
in interface NumberFilters
public Selection eval(DoubleRangePredicate predicate, Number rangeStart, Number rangeEnd)
eval
in interface NumberColumn
eval
in interface NumberFilters
public Selection isIn(Number... numbers)
isIn
in interface NumberColumn
isIn
in interface NumberFilters
public Selection isIn(double... doubles)
isIn
in interface NumberFilters
public Selection isNotIn(Number... numbers)
isNotIn
in interface NumberColumn
isNotIn
in interface NumberFilters
public Selection isNotIn(double... doubles)
isNotIn
in interface NumberFilters
public it.unimi.dsi.fastutil.doubles.DoubleSet asSet()
asSet
in interface NumberColumn
public boolean contains(double value)
contains
in interface NumberColumn
public int byteSize()
Column
byteSize
in interface NumberColumn
byteSize
in interface Column<Double>
public byte[] asBytes(int rowNumber)
asBytes
in interface NumberColumn
asBytes
in interface Column<Double>
rowNumber
- index of the rowpublic int[] asIntArray()
asIntArray
in interface CategoricalColumn<Double>
asIntArray
in interface NumberColumn
public it.unimi.dsi.fastutil.ints.IntSet asIntegerSet()
asIntegerSet
in interface CategoricalColumn<Double>
public it.unimi.dsi.fastutil.doubles.DoubleList dataInternal()
NumberFilters
dataInternal
in interface NumberColumn
dataInternal
in interface NumberFilters
public DateTimeColumn asDateTimes(ZoneOffset offset)
NumberColumn
asDateTimes
in interface NumberColumn
offset
- The ZoneOffset to use in the calculationpublic DoubleColumn fillWith(it.unimi.dsi.fastutil.doubles.DoubleIterator iterator)
fillWith
in interface NumberFillers<NumberColumn>
public DoubleColumn fillWith(it.unimi.dsi.fastutil.doubles.DoubleIterable iterable)
fillWith
in interface NumberFillers<NumberColumn>
public DoubleColumn fillWith(DoubleSupplier supplier)
fillWith
in interface NumberFillers<NumberColumn>
public Object[] asObjectArray()
asObjectArray
in interface Column<Double>
public int compare(Double o1, Double o2)
compare
in interface Comparator<Double>
public int count(DoublePredicate test, int max)
test
- the predicatemax
- the maximum number of rows to countpublic int count(DoublePredicate test)
test
- the predicatepublic boolean allMatch(DoublePredicate test)
test
- the predicatepublic boolean anyMatch(DoublePredicate test)
test
- the predicatepublic boolean noneMatch(DoublePredicate test)
test
- the predicatepublic DoubleColumn filter(DoublePredicate test)
test
- the predicatepublic <R> Column<R> mapInto(DoubleFunction<? extends R> fun, Column<R> into)
fun
- function to mapinto
- Column to which results are appendedpublic DoubleColumn map(ToDoubleFunction<Double> fun)
fun
- function to mappublic Optional<Double> max(it.unimi.dsi.fastutil.doubles.DoubleComparator comp)
comp
- public Optional<Double> min(it.unimi.dsi.fastutil.doubles.DoubleComparator comp)
comp
- public double reduce(double initial, DoubleBinaryOperator op)
initial
- initial valueop
- the operatorpublic Optional<Double> reduce(DoubleBinaryOperator op)
op
- the operatorCopyright © 2018. All rights reserved.