Class FloatColumn
- java.lang.Object
-
- tech.tablesaw.columns.AbstractColumn<C,T>
-
- tech.tablesaw.api.NumberColumn<FloatColumn,Float>
-
- tech.tablesaw.api.FloatColumn
-
- All Implemented Interfaces:
Iterable<Float>,Comparator<Float>,NumericColumn<Float>,Column<Float>,NumberFilters,NumberMapFunctions,FilterSpec<Selection>,NumberFilterSpec<Selection>
public class FloatColumn extends NumberColumn<FloatColumn,Float>
A column that contains float values
-
-
Field Summary
Fields Modifier and Type Field Description protected it.unimi.dsi.fastutil.floats.FloatArrayListdata-
Fields inherited from class tech.tablesaw.api.NumberColumn
comparator, locale
-
Fields inherited from class tech.tablesaw.columns.AbstractColumn
DEFAULT_ARRAY_SIZE
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description FloatColumnappend(float i)FloatColumnappend(Float val)Appends value to the bottom of this column and return this columnFloatColumnappend(Column<Float> column)Appends all the values in the argument to the bottom of this column and return this columnFloatColumnappend(Column<Float> column, int row)Appends the value at the given row in the given column to the bottom of this column and return this columnFloatColumnappendCell(String value)Add one element to the bottom of this column and set its value to the parsed value of the given String.FloatColumnappendCell(String value, AbstractColumnParser<?> parser)Add one element to the bottom of this column and set its value to the parsed value of the given String, as performed by the given parserFloatColumnappendMissing()Appends a missing value appropriate to the columnFloatColumnappendObj(Object obj)Appends the given value to the bottom of this column and return this columnbyte[]asBytes(int rowNumber)Returns the contents of the cell at rowNumber as a byte[].DoubleColumnasDoubleColumn()Returns a new DoubleColumn containing a value for each value in this column.float[]asFloatArray()IntColumnasIntColumn()Returns a new IntColumn containing a value for each value in this column, truncating if necessary.LongColumnasLongColumn()Returns a new LongColumn containing a value for each value in this column, truncating if necessaryFloat[]asObjectArray()Returns an array of objects as appropriate for my type of columnSet<Float>asSet()Returns a Set containing all the unique values in this columnShortColumnasShortColumn()Returns a new IntColumn containing a value for each value in this column, truncating if necessary.FloatColumnbottom(int n)Returns the smallest ("bottom") n values in the column TODO(lwhite): Consider whether this should exclude missingvoidclear()Removes all elements TODO: Make this return this columnintcompare(Float o1, Float o2)FloatColumncopy()Returns a deep copy of the receiverintcountUnique()Returns the count of unique values in this column.static FloatColumncreate(String name)static FloatColumncreate(String name, float... arr)static FloatColumncreate(String name, int initialSize)static FloatColumncreate(String name, Float[] arr)static FloatColumncreate(String name, Stream<Float> stream)FloatColumncreateCol(String name)FloatColumncreateCol(String name, int initialSize)booleanequals(int rowNumber1, int rowNumber2)Returns true if the value in this column at rowNumber1 is equal to the value at rowNumber2Floatget(int index)Returns the value at the given zero-based indexdoublegetDouble(int row)Returns a double representation of the number atindexfloatgetFloat(int row)Returns a float representation of the data at the given index.StringgetString(int row)Returns a string representation of the value at the given row.StringgetUnformattedString(int row)Returns a String representation of the value at index r, without any formatting appliedSelectionisIn(float... numbers)booleanisMissing(int rowNumber)Returns true if the value at rowNumber is missingbooleanisMissingValue(float value)SelectionisNotIn(float... numbers)Iterator<Float>iterator()FloatColumnlag(int n)Returns a column of the same type and size as the receiver, containing the receivers values offset by n.FloatColumnremoveMissing()Returns a copy of this column with the missing values removedFloatColumnset(int i, float val)FloatColumnset(int i, Float val)Sets the value at index row to the given value and return this columnColumn<Float>set(int row, String stringValue, AbstractColumnParser<?> parser)Sets the value at row to the parsed value of the given String using the given parser and returns this columnFloatColumnset(int row, Column<Float> column, int sourceRow)Sets the value at row to the value at sourceRow in the given column and return this columnFloatColumnsetMissing(int i)Sets the value at index i to the missing-value indicator for this column type, and return this columnintsize()Returns the number of elements in this column, including missing valuesvoidsortAscending()Sorts my values in ascending ordervoidsortDescending()Sorts my values in descending orderFloatColumnsubset(int[] rows)Return a column of the same type containing just those elements whose indexes are included in the given arrayFloatColumntop(int n)Returns the largest ("top") n values in the column TODO(lwhite): Consider whether this should exclude missingFloatColumnunique()Returns a column of the same type containing only the unique valuesintvalueHash(int rowNumber)Returns an int suitable as a hash for the value in this column at the given indexstatic booleanvalueIsMissing(float value)-
Methods inherited from class tech.tablesaw.api.NumberColumn
byteSize, countMissing, emptyCopy, emptyCopy, getPrintFormatter, rowComparator, set, set, setPrintFormatter, setPrintFormatter
-
Methods inherited from class tech.tablesaw.columns.AbstractColumn
asStringColumn, filter, first, indexOf, inRange, last, lastIndexOf, map, max, min, name, parser, sampleN, sampleX, set, set, setName, setParser, sorted, 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, asList, columnWidth, contains, count, count, filter, first, indexOf, inRange, last, lastIndexOf, map, map, mapInto, max, max, min, min, name, noneMatch, parser, print, reduce, reduce, sampleN, sampleX, set, set, set, setMissingTo, setName, setParser, sorted, title, type
-
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Methods inherited from interface java.lang.Iterable
forEach, 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
-
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, log10, log1p, logN, multiply, multiply, multiply, name, neg, normalize, pctChange, power, power, reciprocal, remainder, remainder, round, roundInt, sqrt, square, subtract, subtract, subtract
-
Methods inherited from interface tech.tablesaw.api.NumericColumn
allMatch, anyMatch, asDoubleArray, asFloatColumn, asStringColumn, autoCorrelation, autoCorrelation, count, count, eval, eval, geometricMean, interpolate, isEmpty, isIn, isMissing, isNotIn, isNotMissing, kendalls, kurtosis, 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
-
-
-
-
Method Detail
-
getString
public String getString(int row)
Returns a string representation of the value at the given row.- Specified by:
getStringin interfaceColumn<Float>- Overrides:
getStringin classNumberColumn<FloatColumn,Float>- Parameters:
row- The index of the row.- Returns:
- value as String
-
valueHash
public int valueHash(int rowNumber)
Returns an int suitable as a hash for the value in this column at the given index
-
equals
public boolean equals(int rowNumber1, int rowNumber2)Returns true if the value in this column at rowNumber1 is equal to the value at rowNumber2
-
create
public static FloatColumn create(String name)
-
create
public static FloatColumn create(String name, float... arr)
-
create
public static FloatColumn create(String name, int initialSize)
-
create
public static FloatColumn create(String name, Float[] arr)
-
create
public static FloatColumn create(String name, Stream<Float> stream)
-
createCol
public FloatColumn createCol(String name, int initialSize)
- Specified by:
createColin classNumberColumn<FloatColumn,Float>
-
createCol
public FloatColumn createCol(String name)
- Specified by:
createColin classNumberColumn<FloatColumn,Float>
-
get
public Float get(int index)
Returns the value at the given zero-based index
-
valueIsMissing
public static boolean valueIsMissing(float value)
-
subset
public FloatColumn subset(int[] rows)
Return a column of the same type containing just those elements whose indexes are included in the given array- Specified by:
subsetin interfaceColumn<Float>- Overrides:
subsetin classAbstractColumn<FloatColumn,Float>
-
isNotIn
public Selection isNotIn(float... numbers)
-
isIn
public Selection isIn(float... numbers)
-
size
public int size()
Returns the number of elements in this column, including missing values
-
clear
public void clear()
Removes all elements TODO: Make this return this column
-
unique
public FloatColumn unique()
Returns a column of the same type containing only the unique values- Returns:
- a
Column
-
top
public FloatColumn top(int n)
Returns the largest ("top") n values in the column TODO(lwhite): Consider whether this should exclude missing- Specified by:
topin classNumberColumn<FloatColumn,Float>- 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
public FloatColumn bottom(int n)
Returns the smallest ("bottom") n values in the column TODO(lwhite): Consider whether this should exclude missing- Specified by:
bottomin classNumberColumn<FloatColumn,Float>- 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
-
lag
public FloatColumn 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
-
removeMissing
public FloatColumn removeMissing()
Returns a copy of this column with the missing values removed
-
append
public FloatColumn append(float i)
-
append
public FloatColumn append(Float val)
Appends value to the bottom of this column and return this column
-
copy
public FloatColumn copy()
Returns a deep copy of the receiver- Returns:
- a
Column
-
asFloatArray
public float[] asFloatArray()
-
asObjectArray
public Float[] asObjectArray()
Returns an array of objects as appropriate for my type of column
-
set
public FloatColumn set(int i, Float val)
Sets the value at index row to the given value and return this column
-
set
public FloatColumn set(int i, float val)
-
set
public Column<Float> set(int row, String stringValue, AbstractColumnParser<?> parser)
Sets the value at row to the parsed value of the given String using the given parser and returns this column
-
append
public FloatColumn append(Column<Float> column)
Appends all the values in the argument to the bottom of this column and return this column
-
append
public FloatColumn append(Column<Float> column, int row)
Appends the value at the given row in the given column to the bottom of this column and return this column
-
set
public FloatColumn set(int row, Column<Float> column, int sourceRow)
Sets the value at row to the value at sourceRow in the given column and return this column
-
asBytes
public byte[] asBytes(int rowNumber)
Returns the contents of the cell at rowNumber as a byte[].- Parameters:
rowNumber- index of the row- Returns:
- content as byte[]
-
countUnique
public int countUnique()
Returns the count of unique values in this column.- Returns:
- unique values as int
-
getDouble
public double getDouble(int row)
Returns a double representation of the number atindex
-
getFloat
public float getFloat(int row)
Returns a float representation of the data at the given index. Some precision may be lost, and if the value is to large to be cast to a float, an exception is thrown.- Throws:
ClassCastException- if the value can't be cast to ta float
-
isMissingValue
public boolean isMissingValue(float value)
-
isMissing
public boolean isMissing(int rowNumber)
Returns true if the value at rowNumber is missing
-
setMissing
public FloatColumn setMissing(int i)
Sets the value at index i to the missing-value indicator for this column type, and return this column
-
sortAscending
public void sortAscending()
Sorts my values in ascending order
-
sortDescending
public void sortDescending()
Sorts my values in descending order
-
appendMissing
public FloatColumn appendMissing()
Appends a missing value appropriate to the column
-
appendObj
public FloatColumn appendObj(Object obj)
Appends the given value to the bottom of this column and return this column
-
appendCell
public FloatColumn appendCell(String value)
Add one element to the bottom of this column and set its value to the parsed value of the given String. Parsing is type-specific
-
appendCell
public FloatColumn appendCell(String value, AbstractColumnParser<?> parser)
Add one element to the bottom of this column and set its value to the parsed value of the given String, as performed by the given parser
-
getUnformattedString
public String getUnformattedString(int row)
Returns a String representation of the value at index r, without any formatting applied
-
asLongColumn
public LongColumn asLongColumn()
Returns a new LongColumn containing a value for each value in this column, truncating if necessaryA narrowing primitive conversion such as this one may lose information about the overall magnitude of a numeric value and may also lose precision and range. Specifically, if the value is too small (a negative value of large magnitude or negative infinity), the result is the smallest representable value of type long.
Similarly, if the value is too large (a positive value of large magnitude or positive infinity), the result is the largest representable value of type long.
Despite the fact that overflow, underflow, or other loss of information may occur, a narrowing primitive conversion never results in a run-time exception.
A missing value in the receiver is converted to a missing value in the result
-
asIntColumn
public IntColumn asIntColumn()
Returns a new IntColumn containing a value for each value in this column, truncating if necessary.A narrowing primitive conversion such as this one may lose information about the overall magnitude of a numeric value and may also lose precision and range. Specifically, if the value is too small (a negative value of large magnitude or negative infinity), the result is the smallest representable value of type int.
Similarly, if the value is too large (a positive value of large magnitude or positive infinity), the result is the largest representable value of type int.
Despite the fact that overflow, underflow, or other loss of information may occur, a narrowing primitive conversion never results in a run-time exception.
A missing value in the receiver is converted to a missing value in the result
-
asShortColumn
public ShortColumn asShortColumn()
Returns a new IntColumn containing a value for each value in this column, truncating if necessary.A narrowing primitive conversion such as this one may lose information about the overall magnitude of a numeric value and may also lose precision and range. Specifically, if the value is too small (a negative value of large magnitude or negative infinity), the result is the smallest representable value of type int.
Similarly, if the value is too large (a positive value of large magnitude or positive infinity), the result is the largest representable value of type int.
Despite the fact that overflow, underflow, or other loss of information may occur, a narrowing primitive conversion never results in a run-time exception.
A missing value in the receiver is converted to a missing value in the result
-
asDoubleColumn
public DoubleColumn asDoubleColumn()
Returns a new DoubleColumn containing a value for each value in this column.No information is lost in converting from the floats to doubles
A missing value in the receiver is converted to a missing value in the result
-
-