use of water.rapids.vals.ValFrame in project h2o-3 by h2oai.
the class AstSumAxisTest method testRowwisesumOnFrameWithTimeandNumericColumn.
@Test
public void testRowwisesumOnFrameWithTimeandNumericColumn() {
Frame fr = register(new Frame(Key.<Frame>make(), ar("t1", "i1"), aro(vt1, vi1)));
Val val = Rapids.exec("(sumaxis " + fr._key + " 1 1)");
assertTrue(val instanceof ValFrame);
Frame res = register(val.getFrame());
assertColFrameEquals(ard(-1, -2, 0, 2, 1), res);
}
use of water.rapids.vals.ValFrame in project h2o-3 by h2oai.
the class AstSumAxisTest method testRowwisesumOnFrameWithNonnumericColumnsOnly.
@Test
public void testRowwisesumOnFrameWithNonnumericColumnsOnly() {
Frame fr = register(new Frame(Key.<Frame>make(), ar("c1", "s1"), aro(vc2, vs1)));
Val val = Rapids.exec("(sumaxis " + fr._key + " 1 1)");
assertTrue(val instanceof ValFrame);
Frame res = register(val.getFrame());
assertEquals("Unexpected column name", "sum", res.name(0));
assertEquals("Unexpected column type", Vec.T_NUM, res.types()[0]);
assertColFrameEquals(ard(Double.NaN, Double.NaN, Double.NaN, Double.NaN, Double.NaN), res);
}
use of water.rapids.vals.ValFrame in project h2o-3 by h2oai.
the class AstSumAxisTest method testRowwisesumWithoutNaRm.
@Test
public void testRowwisesumWithoutNaRm() {
Frame fr = register(new Frame(Key.<Frame>make(), ar("i1", "d1", "d2", "d3"), aro(vi1, vd1, vd2, vd3)));
Val val = Rapids.exec("(sumaxis " + fr._key + " 0 1)");
assertTrue(val instanceof ValFrame);
Frame res = register(val.getFrame());
assertColFrameEquals(ard(1.7, 2.9, Double.NaN, 10.3, Double.NaN), res);
assertEquals("sum", res.name(0));
}
use of water.rapids.vals.ValFrame in project h2o-3 by h2oai.
the class AstRectangleConditionalAssignTest method testConditionalAssignUUID.
@Test
public void testConditionalAssignUUID() {
UUID newUUID = UUID.randomUUID();
Frame fr = makeTestFrame();
Vec expected = uvec(new UUID(10, 1), newUUID, new UUID(30, 3), newUUID, new UUID(50, 5));
try {
Val val = Rapids.exec("(tmp= py_1 (:= data \"" + newUUID.toString() + "\" 2 (== (cols_py data 4) \"a\")))");
if (val instanceof ValFrame) {
Frame fr2 = val.getFrame();
assertUUIDVecEquals(expected, fr2.vec(2));
fr2.remove();
}
} finally {
fr.remove();
expected.remove();
}
}
use of water.rapids.vals.ValFrame in project h2o-3 by h2oai.
the class AstRectangleConditionalAssignTest method testConditionalAssignNumber.
@Test
public void testConditionalAssignNumber() {
Frame fr = makeTestFrame();
Vec expected = dvec(11.2, -1, 33.6, -1, 56.0);
try {
Val val = Rapids.exec("(tmp= py_1 (:= data -1 1 (== (cols_py data 4) \"a\")))");
if (val instanceof ValFrame) {
Frame fr2 = val.getFrame();
assertVecEquals(expected, fr2.vec(1), 0.00001);
fr2.remove();
}
} finally {
fr.remove();
expected.remove();
}
}
Aggregations