added a test for Table.summarize()
@@ -22,6 +22,8 @@ import tech.tablesaw.columns.Column;
import java.util.Random;
import static org.junit.Assert.*;
+import static tech.tablesaw.aggregate.AggregateFunctions.mean;
+import static tech.tablesaw.aggregate.AggregateFunctions.stdDev;
/**
* Tests for Table
@@ -55,6 +57,15 @@ public class TableTest {
assertNotNull(c1);
}
+ @Test
+ public void testSummarize() throws Exception {
+ Table table = Table.read().csv("../data/tornadoes_1950-2014.csv");
+ Table result = table.summarize("Injuries", mean, stdDev).by("State");
+ assertEquals(49, result.rowCount());
+ assertEquals(3, result.columnCount());
+ assertEquals("4.580805569368455", result.column(1).getString(0));
+ }
+
@Test
public void testColumn() throws Exception {
Column column1 = table.column(0);
