Java Code Examples for tech.tablesaw.api.Table#doubleColumn()
The following examples show how to use
tech.tablesaw.api.Table#doubleColumn() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Stats.java From tablesaw with Apache License 2.0 | 6 votes |
public Table asTableComplete() { Table t = asTable(); StringColumn measure = t.stringColumn("Measure"); DoubleColumn value = t.doubleColumn("Value"); measure.append("Sum of Squares"); value.append(sumOfSquares()); measure.append("Sum of Logs"); value.append(sumOfLogs()); measure.append("Population Variance"); value.append(populationVariance()); measure.append("Geometric Mean"); value.append(geometricMean()); measure.append("Quadratic Mean"); value.append(quadraticMean()); measure.append("Second Moment"); value.append(secondMoment()); return t; }
Example 2
Source File: Stats.java From tablesaw with Apache License 2.0 | 6 votes |
public Table asTableComplete() { Table t = asTable(); StringColumn measure = t.stringColumn("Measure"); DoubleColumn value = t.doubleColumn("Value"); measure.append("Sum of Squares"); value.append(sumOfSquares()); measure.append("Sum of Logs"); value.append(sumOfLogs()); measure.append("Population Variance"); value.append(populationVariance()); measure.append("Geometric Mean"); value.append(geometricMean()); measure.append("Quadratic Mean"); value.append(quadraticMean()); measure.append("Second Moment"); value.append(secondMoment()); return t; }
Example 3
Source File: DataFrameJoiner.java From tablesaw with Apache License 2.0 | 5 votes |
/** Create a reverse index for a given column. */ private Index indexFor(Table table, int colIndex) { ColumnType type = table.column(colIndex).type(); if (type instanceof DateColumnType) { return new IntIndex(table.dateColumn(colIndex)); } else if (type instanceof DateTimeColumnType) { return new LongIndex(table.dateTimeColumn(colIndex)); } else if (type instanceof InstantColumnType) { return new LongIndex(table.instantColumn(colIndex)); } else if (type instanceof TimeColumnType) { return new IntIndex(table.timeColumn(colIndex)); } else if (type instanceof StringColumnType || type instanceof TextColumnType) { return new StringIndex(table.stringColumn(colIndex)); } else if (type instanceof IntColumnType) { return new IntIndex(table.intColumn(colIndex)); } else if (type instanceof LongColumnType) { return new LongIndex(table.longColumn(colIndex)); } else if (type instanceof ShortColumnType) { return new ShortIndex(table.shortColumn(colIndex)); } else if (type instanceof BooleanColumnType) { return new ByteIndex(table.booleanColumn(colIndex)); } else if (type instanceof DoubleColumnType) { return new DoubleIndex(table.doubleColumn(colIndex)); } else if (type instanceof FloatColumnType) { return new FloatIndex(table.floatColumn(colIndex)); } throw new IllegalArgumentException("Joining attempted on unsupported column type " + type); }
Example 4
Source File: DataFrameJoiner.java From tablesaw with Apache License 2.0 | 5 votes |
/** Create a reverse index for a given column. */ private Index indexFor(Table table, int colIndex) { ColumnType type = table.column(colIndex).type(); if (type instanceof DateColumnType) { return new IntIndex(table.dateColumn(colIndex)); } else if (type instanceof DateTimeColumnType) { return new LongIndex(table.dateTimeColumn(colIndex)); } else if (type instanceof InstantColumnType) { return new LongIndex(table.instantColumn(colIndex)); } else if (type instanceof TimeColumnType) { return new IntIndex(table.timeColumn(colIndex)); } else if (type instanceof StringColumnType || type instanceof TextColumnType) { return new StringIndex(table.stringColumn(colIndex)); } else if (type instanceof IntColumnType) { return new IntIndex(table.intColumn(colIndex)); } else if (type instanceof LongColumnType) { return new LongIndex(table.longColumn(colIndex)); } else if (type instanceof ShortColumnType) { return new ShortIndex(table.shortColumn(colIndex)); } else if (type instanceof BooleanColumnType) { return new ByteIndex(table.booleanColumn(colIndex)); } else if (type instanceof DoubleColumnType) { return new DoubleIndex(table.doubleColumn(colIndex)); } else if (type instanceof FloatColumnType) { return new FloatIndex(table.floatColumn(colIndex)); } throw new IllegalArgumentException("Joining attempted on unsupported column type " + type); }
Example 5
Source File: GettingStarted.java From tablesaw with Apache License 2.0 | 4 votes |
private void workingWithTablesColumns() { // Setup code. Table table = Table.create(); StringColumn column1 = StringColumn.create("col1"); StringColumn column2 = StringColumn.create("col2"); StringColumn column3 = StringColumn.create("col3"); try { // @@ working_with_columns_examples List<String> columnNames = table.columnNames(); // returns all column names List<Column<?>> columns = table.columns(); // returns all the columns in the table // removing columns table.removeColumns("Foo"); // keep everything but "foo" table.retainColumns("Foo", "Bar"); // only keep foo and bar table.removeColumnsWithMissingValues(); // adding columns table.addColumns(column1, column2, column3); // @@ working_with_columns_examples // @@ get_column_case_insensitive table.column("FOO"); table.column("foo"); table.column("foO"); // @@ get_column_case_insensitive // @@ get_column table.column("Foo"); // returns the column named 'Foo' if it's in the table. // or table.column(0); // returns the first column // @@ get_column // @@ get_column_cast StringColumn sc = (StringColumn) table.column(0); // @@ get_column_cast // @@ get_typed_columns StringColumn strings = table.stringColumn(0); DateColumn dates = table.dateColumn("start date"); DoubleColumn doubles = table.doubleColumn("doubles"); // @@ get_typed_columns } catch (Exception e) { } }
Example 6
Source File: GettingStarted.java From tablesaw with Apache License 2.0 | 4 votes |
private void workingWithTablesColumns() { // Setup code. Table table = Table.create(); StringColumn column1 = StringColumn.create("col1"); StringColumn column2 = StringColumn.create("col2"); StringColumn column3 = StringColumn.create("col3"); try { // @@ working_with_columns_examples List<String> columnNames = table.columnNames(); // returns all column names List<Column<?>> columns = table.columns(); // returns all the columns in the table // removing columns table.removeColumns("Foo"); // keep everything but "foo" table.retainColumns("Foo", "Bar"); // only keep foo and bar table.removeColumnsWithMissingValues(); // adding columns table.addColumns(column1, column2, column3); // @@ working_with_columns_examples // @@ get_column_case_insensitive table.column("FOO"); table.column("foo"); table.column("foO"); // @@ get_column_case_insensitive // @@ get_column table.column("Foo"); // returns the column named 'Foo' if it's in the table. // or table.column(0); // returns the first column // @@ get_column // @@ get_column_cast StringColumn sc = (StringColumn) table.column(0); // @@ get_column_cast // @@ get_typed_columns StringColumn strings = table.stringColumn(0); DateColumn dates = table.dateColumn("start date"); DoubleColumn doubles = table.doubleColumn("doubles"); // @@ get_typed_columns } catch (Exception e) { } }