本文整理汇总了Java中tech.tablesaw.api.Table.column方法的典型用法代码示例。如果您正苦于以下问题:Java Table.column方法的具体用法?Java Table.column怎么用?Java Table.column使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tech.tablesaw.api.Table
的用法示例。
在下文中一共展示了Table.column方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: apply
import tech.tablesaw.api.Table; //导入方法依赖的package包/类
@Override
public Selection apply(Table relation) {
String name = columnReference().getColumnName();
Column column = relation.column(name);
ColumnType type = column.type();
switch (type) {
case LOCAL_TIME:
TimeColumn timeColumn = relation.timeColumn(name);
return timeColumn.isBeforeNoon();
case LOCAL_DATE_TIME:
DateTimeColumn dateTimeColumn = relation.dateTimeColumn(name);
return dateTimeColumn.isBeforeNoon();
default:
throw new UnsupportedOperationException("Columns of type " + type.name() + " do not support the operation "
+ "isBeforeNoon() ");
}
}
示例2: apply
import tech.tablesaw.api.Table; //导入方法依赖的package包/类
@Override
public Selection apply(Table relation) {
String name = columnReference().getColumnName();
Column column = relation.column(name);
ColumnType type = column.type();
switch (type) {
case LOCAL_DATE:
DateColumn dateColumn = relation.dateColumn(name);
return dateColumn.isTuesday();
case LOCAL_DATE_TIME:
DateTimeColumn dateTimeColumn = relation.dateTimeColumn(name);
return dateTimeColumn.isTuesday();
default:
throw new UnsupportedOperationException("Columns of type " + type.name() + " do not support the operation "
+ "isTuesday() ");
}
}
示例3: apply
import tech.tablesaw.api.Table; //导入方法依赖的package包/类
@Override
public Selection apply(Table relation) {
String name = columnReference().getColumnName();
Column column = relation.column(name);
ColumnType type = column.type();
switch (type) {
case LOCAL_DATE:
DateColumn dateColumn = relation.dateColumn(name);
return dateColumn.isInDecember();
case LOCAL_DATE_TIME:
DateTimeColumn dateTimeColumn = relation.dateTimeColumn(name);
return dateTimeColumn.isInDecember();
default:
throw new UnsupportedOperationException("Columns of type " + type.name() + " do not support the operation "
+ "isInDecember() ");
}
}
示例4: apply
import tech.tablesaw.api.Table; //导入方法依赖的package包/类
@Override
public Selection apply(Table relation) {
String name = columnReference().getColumnName();
Column column = relation.column(name);
ColumnType type = column.type();
switch (type) {
case LOCAL_DATE:
DateColumn dateColumn = relation.dateColumn(name);
return dateColumn.isInQ3();
case LOCAL_DATE_TIME:
DateTimeColumn dateTimeColumn = relation.dateTimeColumn(name);
return dateTimeColumn.isInQ3();
default:
throw new UnsupportedOperationException("Columns of type " + type.name() + " do not support the operation "
+ "isInQ3() ");
}
}
示例5: apply
import tech.tablesaw.api.Table; //导入方法依赖的package包/类
@Override
public Selection apply(Table relation) {
String name = columnReference().getColumnName();
Column column = relation.column(name);
ColumnType type = column.type();
switch (type) {
case LOCAL_DATE:
DateColumn dateColumn = relation.dateColumn(name);
return dateColumn.isInNovember();
case LOCAL_DATE_TIME:
DateTimeColumn dateTimeColumn = relation.dateTimeColumn(name);
return dateTimeColumn.isInNovember();
default:
throw new UnsupportedOperationException("Columns of type " + type.name() + " do not support the operation "
+ "isInNovember() ");
}
}
示例6: apply
import tech.tablesaw.api.Table; //导入方法依赖的package包/类
@Override
public Selection apply(Table relation) {
String name = columnReference().getColumnName();
Column column = relation.column(name);
ColumnType type = column.type();
switch (type) {
case LOCAL_DATE:
DateColumn dateColumn = relation.dateColumn(name);
return dateColumn.isInApril();
case LOCAL_DATE_TIME:
DateTimeColumn dateTimeColumn = relation.dateTimeColumn(name);
return dateTimeColumn.isInApril();
default:
throw new UnsupportedOperationException("Columns of type " + type.name() + " do not support the operation "
+ "isInApril() ");
}
}
示例7: apply
import tech.tablesaw.api.Table; //导入方法依赖的package包/类
@Override
public Selection apply(Table relation) {
String name = columnReference().getColumnName();
Column column = relation.column(name);
ColumnType type = column.type();
switch (type) {
case LOCAL_DATE:
DateColumn dateColumn = relation.dateColumn(name);
return dateColumn.isInSeptember();
case LOCAL_DATE_TIME:
DateTimeColumn dateTimeColumn = relation.dateTimeColumn(name);
return dateTimeColumn.isInSeptember();
default:
throw new UnsupportedOperationException("Columns of type " + type.name() + " do not support the operation "
+ "isInSeptember() ");
}
}
示例8: apply
import tech.tablesaw.api.Table; //导入方法依赖的package包/类
public Selection apply(Table relation) {
Column column = relation.column(columnReference.getColumnName());
ColumnType type = column.type();
switch (type) {
case CATEGORY: {
CategoryColumn categoryColumn = (CategoryColumn) relation.column(columnReference.getColumnName());
return categoryColumn.isNotEqualTo(value);
}
default:
throw new UnsupportedOperationException(
String.format("ColumnType %s does not support equalTo on a String value", type));
}
}
示例9: apply
import tech.tablesaw.api.Table; //导入方法依赖的package包/类
@Override
public Selection apply(Table relation) {
Column column = relation.column(columnReference().getColumnName());
CategoryColumn textColumn = (CategoryColumn) column;
return textColumn.matchesRegex(string);
}
示例10: apply
import tech.tablesaw.api.Table; //导入方法依赖的package包/类
@Override
public Selection apply(Table relation) {
Column column = relation.column(columnReference().getColumnName());
CategoryColumn textColumn = (CategoryColumn) column;
return textColumn.isUpperCase();
}
示例11: main
import tech.tablesaw.api.Table; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
// Get the data
Table baseball = Table.read().csv("../data/baseball.csv");
out(baseball.structure());
// filter to the data available in the 2002 season
Table moneyball = baseball.selectWhere(column("year").isLessThan(2002));
// plot regular season wins against year, segregating on whether the team made the plays
NumericColumn wins = moneyball.numericColumn("W");
NumericColumn year = moneyball.numericColumn("Year");
Column playoffs = moneyball.column("Playoffs");
Scatter.show("Regular season wins by year", wins, year, moneyball.splitOn(playoffs));
// Calculate the run difference for use in the regression model
IntColumn runDifference = moneyball.shortColumn("RS").subtract(moneyball.shortColumn("RA"));
moneyball.addColumn(runDifference);
runDifference.setName("RD");
// Plot RD vs Wins to see if the relationship looks linear
Scatter.show("RD x Wins", moneyball.numericColumn("RD"), moneyball.numericColumn("W"));
// Create the regression model
//ShortColumn wins = moneyball.shortColumn("W");
LeastSquares winsModel = LeastSquares.train(wins, runDifference);
out(winsModel);
// Make a prediction of how many games we win if we score 135 more runs than our opponents
double[] testValue = new double[1];
testValue[0] = 135;
double prediction = winsModel.predict(testValue);
out("Predicted wins with RD = 135: " + prediction);
// Predict runsScored based on On-base percentage, batting average and slugging percentage
LeastSquares runsScored = LeastSquares.train(moneyball.nCol("RS"),
moneyball.nCol("OBP"), moneyball.nCol("BA"), moneyball.nCol("SLG"));
out(runsScored);
LeastSquares runsScored2 = LeastSquares.train(moneyball.nCol("RS"),
moneyball.nCol("OBP"), moneyball.nCol("SLG"));
out(runsScored2);
Histogram.show(runsScored2.residuals());
Scatter.fittedVsResidual(runsScored2);
Scatter.actualVsFitted(runsScored2);
// We use opponent OBP and opponent SLG to model the efficacy of our pitching and defence
Table moneyball2 = moneyball.selectWhere(column("year").isGreaterThan(1998));
LeastSquares runsAllowed = LeastSquares.train(moneyball2.nCol("RA"),
moneyball2.nCol("OOBP"), moneyball2.nCol("OSLG"));
out(runsAllowed);
}
示例12: apply
import tech.tablesaw.api.Table; //导入方法依赖的package包/类
@Override
public Selection apply(Table relation) {
Column column = relation.column(columnReference().getColumnName());
CategoryColumn textColumn = (CategoryColumn) column;
return textColumn.isShorterThan(length);
}
示例13: apply
import tech.tablesaw.api.Table; //导入方法依赖的package包/类
public Selection apply(Table relation) {
Column column = relation.column(columnReference().getColumnName());
Column other = relation.column(otherColumn.getColumnName());
Preconditions.checkArgument(column.type() == other.type());
if (column.type() == ColumnType.INTEGER)
return apply((IntColumn) column, (IntColumn) other);
if (column.type() == ColumnType.LONG_INT)
return apply((LongColumn) column, (LongColumn) other);
if (column.type() == ColumnType.SHORT_INT)
return apply((ShortColumn) column, (ShortColumn) other);
if (column.type() == ColumnType.FLOAT)
return apply((FloatColumn) column, (FloatColumn) other);
if (column.type() == ColumnType.DOUBLE)
return apply((DoubleColumn) column, (DoubleColumn) other);
throw new UnsupportedOperationException("Not supported (currently) for this column type");
}
示例14: apply
import tech.tablesaw.api.Table; //导入方法依赖的package包/类
@Override
public Selection apply(Table relation) {
DateTimeColumn dateColumn = (DateTimeColumn) relation.column(columnReference().getColumnName());
return dateColumn.isOnOrAfter(value);
}
示例15: apply
import tech.tablesaw.api.Table; //导入方法依赖的package包/类
public Selection apply(Table relation) {
BooleanColumn booleanColumn = (BooleanColumn) relation.column(columnReference.getColumnName());
return booleanColumn.isFalse();
}