Constructor | Description |
---|---|
Relation() |
Modifier and Type | Method | Description |
---|---|---|
abstract Relation |
addColumns(Column<?>... cols) |
Adds the given columns to this Relation and returns the same relation.
|
TableConverter |
as() |
Returns an
TableConverter that can convert this Relation to a
two-dimensional matrix of primitive numeric values |
BooleanColumn |
booleanColumn(int columnIndex) |
Returns the DoubleColumn at the given 0-based index if present.
|
BooleanColumn |
booleanColumn(String columnName) |
Returns a BooleanColumn with the given name if it is present in this Relation.
|
BooleanColumn[] |
booleanColumns() |
Returns all BooleanColumns in this Relation as an Array
|
CategoricalColumn<?> |
categoricalColumn(int columnNumber) |
Returns the CategoricalColumn at the given 0-based index if present.
|
CategoricalColumn<?> |
categoricalColumn(String columnName) |
Returns a CategoricalColumn with the given name if it is present in this Relation.
|
List<CategoricalColumn<?>> |
categoricalColumns(String... columnName) |
Returns the columns whose names are given in the input array
|
abstract void |
clear() |
Clears all the dat in the relation, leaving the structure intact
|
abstract Column<?> |
column(int columnIndex) |
Returns the column at columnIndex (0-based)
|
Column<?> |
column(String columnName) |
Returns the column with the given columnName, ignoring case
|
abstract int |
columnCount() |
Returns the number of columns in the relation
|
int |
columnIndex(String columnName) |
Returns the index of the column with the given columnName
|
abstract int |
columnIndex(Column<?> col) |
Returns the index of the given column
|
abstract List<String> |
columnNames() |
Returns a list containing the names of all the columns in this relation
|
abstract List<Column<?>> |
columns() |
Returns a list of all the columns in the relation
|
List<Column<?>> |
columns(int... columnIndices) |
Returns the columns whose indices are given in the input array
|
List<Column<?>> |
columns(String... columnName) |
Returns the columns whose names are given in the input array
|
List<Column<?>> |
columnsOfType(ColumnType type) |
Returns a list containing all the columns of the given type in this Relation
|
ColumnType[] |
columnTypes() |
Deprecated.
for API name consistency. Use
typeArray() instead. |
int[] |
colWidths() |
Returns an array of column widths for printing tables
|
boolean |
containsColumn(String columnName) |
Returns true if a column with the given name is in this Relation
|
boolean |
containsColumn(Column<?> column) |
Returns true if the given column is in this Relation
|
DateColumn |
dateColumn(int columnIndex) |
Returns the DateColumn at the given 0-based index if present.
|
DateColumn |
dateColumn(String columnName) |
Returns a DateColumn with the given name if it is present in this Relation.
|
DateColumn[] |
dateColumns() |
Returns all DateColumns in this Relation as an Array
|
DateTimeColumn |
dateTimeColumn(int columnIndex) |
Returns the DateTimeColumn at the given 0-based index if present.
|
DateTimeColumn |
dateTimeColumn(String columnName) |
Returns a DateTimeColumn with the given name if it is present in this Relation.
|
DateTimeColumn[] |
dateTimeColumns() |
Returns all DateTimeColumns in this Relation as an Array
|
DoubleColumn |
doubleColumn(int columnIndex) |
Returns the DoubleColumn at the given 0-based index if present.
|
DoubleColumn |
doubleColumn(String columnName) |
Returns a DoubleColumn with the given name if it is present in this Relation.
|
abstract Table |
first(int nRows) |
Returns a new table containing the first n rows in this Relation
|
FloatColumn |
floatColumn(int columnIndex) |
Returns the FloatColumn at the given 0-based index if present.
|
FloatColumn |
floatColumn(String columnName) |
Returns a FloatColumn with the given name if it is present in this Relation.
|
Object |
get(int r,
int c) |
Returns the value at the given row and column indexes
|
String |
getString(int r,
int columnIndex) |
Returns a string representation of the value at the given row and column indexes
|
String |
getString(int r,
String columnName) |
Returns a string representation of the value at the given row and column indexes
|
String |
getUnformatted(int r,
int c) |
Returns a string representation of the value at the given row and column indexes
|
InstantColumn |
instantColumn(int columnIndex) |
Returns the InstantColumn at the given 0-based index if present.
|
InstantColumn |
instantColumn(String columnName) |
Returns an InstantColumn with the given name if it is present in this Relation.
|
InstantColumn[] |
instantColumns() |
Returns all InstantColumns in this Relation as an Array
|
IntColumn |
intColumn(int columnIndex) |
Returns the IntColumn at the given 0-based index if present.
|
IntColumn |
intColumn(String columnName) |
Returns an IntColumn with the given name if it is present in this Relation.
|
boolean |
isEmpty() |
Returns true if this relation has zero rows and false otherwise.
|
LongColumn |
longColumn(int columnIndex) |
Returns the LongColumn at the given 0-based index if present.
|
LongColumn |
longColumn(String columnName) |
Returns a LongColumn with the given name if it is present in this Relation.
|
abstract String |
name() |
Returns the name of this relation
|
NumericColumn<?> |
nCol(int columnIndex) |
Returns the column with the given name cast to a NumberColumn
|
NumericColumn<?> |
nCol(String columnName) |
Returns the column with the given name cast to a NumberColumn.
|
NumericColumn<?> |
numberColumn(int columnIndex) |
Returns the NumberColumn at the given index.
|
NumericColumn<?> |
numberColumn(String columnName) |
Returns a NumericColumn with the given name if it is present in this Relation.
|
NumericColumn<?>[] |
numberColumns() |
Returns all the NumericColumns in this Relation as an Array
|
List<NumericColumn<?>> |
numericColumns() |
Returns all the NumericColumns in the relation
|
List<NumericColumn<?>> |
numericColumns(int... columnIndices) |
Returns all the NumericColumns in the relation
|
List<NumericColumn<?>> |
numericColumns(String... columnNames) |
Returns all the NumericColumns in the relation
|
String |
print() |
Returns a String containing a 'pretty-printed' representation of this table containing at most
20 rows.
|
String |
print(int rowLimit) |
Returns a 'pretty-printed' string representation of at most rowLimit rows from this relation.
|
String |
printAll() |
Returns a 'pretty-printed' string representation of this entire relation.
|
Relation |
removeColumns(int... columnIndexes) |
Removes the columns at the given 0-based indices from this Relation and returns the same
relation.
|
Relation |
removeColumns(String... columnName) |
Removes the columns with the given namesfrom this Relation and returns the same relation.
|
abstract Relation |
removeColumns(Column<?>... columns) |
Removes the given columns from this Relation and returns the same relation.
|
abstract int |
rowCount() |
Returns the number of rows in the relation
|
abstract Relation |
setName(String name) |
Sets the name of this Relation and returns the same relation.
|
String |
shape() |
Returns a string that tells how many rows and columns this relation has
|
ShortColumn |
shortColumn(int columnIndex) |
Returns the ShortColumn at the given 0-based index if present.
|
ShortColumn |
shortColumn(String columnName) |
Returns a ShortColumn with the given name if it is present in this Relation.
|
SmileConverter |
smile() |
Returns an
SmileConverter that can convert this table to
a format suitable for use with the Smile machine learning library. |
StringColumn |
stringColumn(int columnIndex) |
Returns the StringColumn at the given 0-based index if present.
|
StringColumn |
stringColumn(String columnName) |
Returns a StringColumn with the given name if it is present in this Relation.
|
StringColumn[] |
stringColumns() |
Returns all the StringColumns in this Relation as an Array
|
Table |
structure() |
Returns the structure of the this relation as a 3-column Table, consisting of Index (an
IntColumn), Column Name (a StringColumn), and Column Type (a StringColumn)
|
Table |
summary() |
Returns a table containing summary statistics for the columns in this Relation
|
TextColumn |
textColumn(int columnIndex) |
Returns the TextColumn at the given 0-based index if present.
|
TextColumn |
textColumn(String columnName) |
Returns a TextColumn with the given name if it is present in this Relation.
|
TimeColumn |
timeColumn(int columnIndex) |
Returns the TimeColumn at the given 0-based index if present.
|
TimeColumn |
timeColumn(String columnName) |
Returns a TimeColumn with the given name if it is present in this Relation.
|
TimeColumn[] |
timeColumns() |
Returns all TimeColumns in this Relation as an Array
|
String |
toString() |
Returns a String containing a 'pretty-printed' representation of this table containing at most
20 rows.
|
ColumnType[] |
typeArray() |
Returns an array of the column types of all columns in the relation, including duplicates as
appropriate, and maintaining order
|
List<ColumnType> |
types() |
Returns a List of the column types of all columns in the relation, including duplicates as
appropriate, and maintaining order
|
forEach, iterator, spliterator
public abstract Relation addColumns(Column<?>... cols)
public abstract Relation setName(String name)
public boolean isEmpty()
public String shape()
public Relation removeColumns(int... columnIndexes)
public abstract Relation removeColumns(Column<?>... columns)
public Relation removeColumns(String... columnName)
public List<Column<?>> columnsOfType(ColumnType type)
public abstract Table first(int nRows)
public int columnIndex(String columnName)
public Column<?> column(String columnName)
public abstract Column<?> column(int columnIndex)
columnIndex
- an integer at least 0 and less than number of columns in the relationpublic abstract int columnCount()
public abstract int rowCount()
public abstract List<Column<?>> columns()
public List<Column<?>> columns(String... columnName)
public List<Column<?>> columns(int... columnIndices)
public abstract int columnIndex(Column<?> col)
public Object get(int r, int c)
r
- the row index, 0 basedc
- the column index, 0 basedpublic abstract String name()
public abstract void clear()
public abstract List<String> columnNames()
@Deprecated public ColumnType[] columnTypes()
typeArray()
instead.public ColumnType[] typeArray()
public List<ColumnType> types()
public int[] colWidths()
public String toString()
public String printAll()
public String print(int rowLimit)
public String print()
public Table structure()
public Table summary()
public BooleanColumn booleanColumn(int columnIndex)
public BooleanColumn booleanColumn(String columnName)
public NumericColumn<?> numberColumn(int columnIndex)
columnIndex
- The 0-based index of a column in the tableClassCastException
- if the cast to NumberColumn failspublic NumericColumn<?> numberColumn(String columnName)
public DoubleColumn doubleColumn(String columnName)
public DoubleColumn doubleColumn(int columnIndex)
public StringColumn[] stringColumns()
public NumericColumn<?>[] numberColumns()
public List<NumericColumn<?>> numericColumns()
public List<NumericColumn<?>> numericColumns(int... columnIndices)
public List<NumericColumn<?>> numericColumns(String... columnNames)
public BooleanColumn[] booleanColumns()
public DateColumn[] dateColumns()
public DateTimeColumn[] dateTimeColumns()
public InstantColumn[] instantColumns()
public TimeColumn[] timeColumns()
public CategoricalColumn<?> categoricalColumn(String columnName)
public CategoricalColumn<?> categoricalColumn(int columnNumber)
public List<CategoricalColumn<?>> categoricalColumns(String... columnName)
public NumericColumn<?> nCol(String columnName)
Shorthand for numberColumn()
public NumericColumn<?> nCol(int columnIndex)
Shorthand for numberColumn()
public IntColumn intColumn(String columnName)
public IntColumn intColumn(int columnIndex)
public ShortColumn shortColumn(String columnName)
public ShortColumn shortColumn(int columnIndex)
public LongColumn longColumn(String columnName)
public LongColumn longColumn(int columnIndex)
public FloatColumn floatColumn(String columnName)
public FloatColumn floatColumn(int columnIndex)
public DateColumn dateColumn(int columnIndex)
public DateColumn dateColumn(String columnName)
public TimeColumn timeColumn(String columnName)
public TimeColumn timeColumn(int columnIndex)
public StringColumn stringColumn(String columnName)
public StringColumn stringColumn(int columnIndex)
public TextColumn textColumn(String columnName)
public TextColumn textColumn(int columnIndex)
public DateTimeColumn dateTimeColumn(int columnIndex)
public DateTimeColumn dateTimeColumn(String columnName)
public InstantColumn instantColumn(int columnIndex)
public InstantColumn instantColumn(String columnName)
public TableConverter as()
TableConverter
that can convert this Relation to a
two-dimensional matrix of primitive numeric valuespublic SmileConverter smile()
SmileConverter
that can convert this table to
a format suitable for use with the Smile machine learning library.public String getUnformatted(int r, int c)
r
- the row index, 0 basedc
- the column index, 0 basedpublic String getString(int r, String columnName)
r
- the row index, 0 basedcolumnName
- the name of the column to be returned
// TODO: performance would be enhanced if columns could be referenced via a hashTable
public String getString(int r, int columnIndex)
r
- the row index, 0 basedcolumnIndex
- the index of the column to be returned
// TODO: performance would be enhanced if columns could be referenced via a hashTable
public boolean containsColumn(Column<?> column)
public boolean containsColumn(String columnName)
Copyright © 2022. All rights reserved.