Package tech.tablesaw.columns
Class AbstractColumn<C extends Column<T>,T>
java.lang.Object
tech.tablesaw.columns.AbstractColumn<C,T>
- All Implemented Interfaces:
Iterable<T>
,Comparator<T>
,Column<T>
- Direct Known Subclasses:
AbstractStringColumn
,BooleanColumn
,DateColumn
,DateTimeColumn
,InstantColumn
,NumberColumn
,TimeColumn
Partial implementation of the
Column
interface-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractColumn
(ColumnType type, String name, AbstractColumnParser<T> parser) Constructs a column with the givenColumnType
, name, andAbstractColumnParser
-
Method Summary
Modifier and TypeMethodDescriptionReturns a StringColumn consisting of the (unformatted) String representation of this column valuesReturns a copy of the receiver with no data.Returns a new Column of the same type with only those rows satisfying the predicatefirst
(int numRows) Returns a column of the same type containing the firstnumRows
of this column.int
Returns the index of the first occurrence ofo
in the column or -1 if the element is not in the column.inRange
(int start, int end) Returns a column containing the rows in this column beginning with start inclusive, and ending with end exclusivelast
(int numRows) Returns a column of the same type containing the lastnumRows
of this column.Maps the function across all rows, appending the results to a new Column of the same typeReturns a column containing the element-wise min between this column and other columnReturns a column containing the element-wise min between this column and other columnname()
Returns the column's name.parser()
Returns the parser used byColumn.appendCell(String)
()}.sampleN
(int n) Returns a column containing a random sample of the values in this columnsampleX
(double proportion) Returns a table consisting of randomly selected values from this column.Conditionally update this column, replacing current values with newValue for all rows where the current value matches the selection criteriaUpdates this column where values matching the selection are replaced with the corresponding value from the given columnSets the columns name to the given stringsetParser
(AbstractColumnParser<T> parser) Sets the parser used byColumn.appendCell(String)
sorted
(Comparator<? super T> comp) Returns a new Column of the same type sorted according to the provided Comparatorsubset
(int[] rows) Return a column of the same type containing just those elements whose indexes are included in the given arraytoString()
type()
Returns this column's ColumnTypeMethods 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, append, append, append, appendCell, appendCell, appendMissing, appendObj, asBytes, asList, asObjectArray, asSet, byteSize, clear, columnWidth, contains, copy, count, count, countMissing, countUnique, emptyCopy, equals, get, getString, getUnformattedString, interpolate, isEmpty, isMissing, isMissing, isNotMissing, lag, lead, map, mapInto, max, min, noneMatch, print, reduce, reduce, removeMissing, rolling, rowComparator, set, set, set, set, setMissing, setMissingTo, size, sortAscending, sortDescending, summary, title, unique, valueHash, where
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
-
Field Details
-
DEFAULT_ARRAY_SIZE
public static final int DEFAULT_ARRAY_SIZE- See Also:
-
-
Constructor Details
-
AbstractColumn
Constructs a column with the givenColumnType
, name, andAbstractColumnParser
-
-
Method Details
-
name
Returns the column's name. -
setName
Sets the columns name to the given string -
parser
Returns the parser used byColumn.appendCell(String)
()}. -
setParser
Sets the parser used byColumn.appendCell(String)
-
type
Returns this column's ColumnType -
emptyCopy
Returns a copy of the receiver with no data. The column name and type are the same. -
filter
Returns a new Column of the same type with only those rows satisfying the predicate -
sorted
Returns a new Column of the same type sorted according to the provided Comparator -
map
Maps the function across all rows, appending the results to a new Column of the same type -
min
Returns a column containing the element-wise min between this column and other columnTODO(lwhite) Override in column subtypes for better performance
-
max
Returns a column containing the element-wise min between this column and other columnTODO(lwhite) Override in column subtypes for better performance
-
set
Updates this column where values matching the selection are replaced with the corresponding value from the given column -
set
Conditionally update this column, replacing current values with newValue for all rows where the current value matches the selection criteria -
first
Returns a column of the same type containing the firstnumRows
of this column. -
last
Returns a column of the same type containing the lastnumRows
of this column. -
sampleN
Returns a column containing a random sample of the values in this column -
sampleX
Returns a table consisting of randomly selected values from this column. The sample size is based on the given proportion of the total number of cells in this column -
subset
Return a column of the same type containing just those elements whose indexes are included in the given array -
inRange
Returns a column containing the rows in this column beginning with start inclusive, and ending with end exclusive -
toString
-
asStringColumn
Returns a StringColumn consisting of the (unformatted) String representation of this column values- Specified by:
asStringColumn
in interfaceColumn<C extends Column<T>>
- Returns:
- a
StringColumn
built using the columnColumn.getUnformattedString(int)
method
-
indexOf
Returns the index of the first occurrence ofo
in the column or -1 if the element is not in the column.
-