Search in sources :

Example 41 with Table

use of tech.tablesaw.api.Table in project symja_android_library by axkr.

the class ShortDictionaryMap method countByCategory.

/**
 */
@Override
public Table countByCategory(String columnName) {
    Table t = Table.create("Column: " + columnName);
    StringColumn categories = StringColumn.create("Category");
    IntColumn counts = IntColumn.create("Count");
    // Now uses the keyToCount map
    for (Map.Entry<Short, Integer> entry : keyToCount.short2IntEntrySet()) {
        categories.append(getValueForKey(entry.getKey()));
        counts.append(entry.getValue());
    }
    t.addColumns(categories);
    t.addColumns(counts);
    return t;
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) StringColumn(tech.tablesaw.api.StringColumn) Table(tech.tablesaw.api.Table) Short2IntOpenHashMap(it.unimi.dsi.fastutil.shorts.Short2IntOpenHashMap) Map(java.util.Map) Short2IntMap(it.unimi.dsi.fastutil.shorts.Short2IntMap) Object2ShortOpenHashMap(it.unimi.dsi.fastutil.objects.Object2ShortOpenHashMap) Short2ObjectOpenHashMap(it.unimi.dsi.fastutil.shorts.Short2ObjectOpenHashMap) Short2ObjectMap(it.unimi.dsi.fastutil.shorts.Short2ObjectMap) IntColumn(tech.tablesaw.api.IntColumn)

Example 42 with Table

use of tech.tablesaw.api.Table in project symja_android_library by axkr.

the class Stats method asTableComplete.

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;
}
Also used : StringColumn(tech.tablesaw.api.StringColumn) Table(tech.tablesaw.api.Table) DoubleColumn(tech.tablesaw.api.DoubleColumn)

Aggregations

Table (tech.tablesaw.api.Table)42 StringColumn (tech.tablesaw.api.StringColumn)10 ArrayList (java.util.ArrayList)9 DoubleColumn (tech.tablesaw.api.DoubleColumn)8 IntColumn (tech.tablesaw.api.IntColumn)8 ColumnType (tech.tablesaw.api.ColumnType)7 Column (tech.tablesaw.columns.Column)7 TreeBasedTable (com.google.common.collect.TreeBasedTable)5 Map (java.util.Map)5 List (java.util.List)3 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)3 IExpr (org.matheclipse.core.interfaces.IExpr)3 ExprColumn (tech.tablesaw.api.ExprColumn)3 Row (tech.tablesaw.api.Row)3 InputStream (java.io.InputStream)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 IAST (org.matheclipse.core.interfaces.IAST)2 Strings (com.google.common.base.Strings)1 Lists (com.google.common.collect.Lists)1