Search in sources :

Example 21 with IntColumn

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

the class Relation method structure.

public Table structure() {
    Table t = Table.create("Structure of " + name());
    IntColumn index = IntColumn.indexColumn("Index", columnCount(), 0);
    StringColumn columnName = StringColumn.create("Column Name", columnCount());
    StringColumn columnType = StringColumn.create("Column Type", columnCount());
    t.addColumns(index);
    t.addColumns(columnName);
    t.addColumns(columnType);
    for (int i = 0; i < columnCount(); i++) {
        Column<?> column = this.columns().get(i);
        columnType.set(i, column.type().name());
        columnName.set(i, columnNames().get(i));
    }
    return t;
}
Also used : StringColumn(tech.tablesaw.api.StringColumn) Table(tech.tablesaw.api.Table) IntColumn(tech.tablesaw.api.IntColumn)

Example 22 with IntColumn

use of tech.tablesaw.api.IntColumn 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)

Aggregations

IntColumn (tech.tablesaw.api.IntColumn)22 Table (tech.tablesaw.api.Table)7 StringColumn (tech.tablesaw.api.StringColumn)4 Map (java.util.Map)3 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)3 DoubleColumn (tech.tablesaw.api.DoubleColumn)2 TreeBasedTable (com.google.common.collect.TreeBasedTable)1 Byte2IntMap (it.unimi.dsi.fastutil.bytes.Byte2IntMap)1 Byte2IntOpenHashMap (it.unimi.dsi.fastutil.bytes.Byte2IntOpenHashMap)1 Byte2ObjectMap (it.unimi.dsi.fastutil.bytes.Byte2ObjectMap)1 Byte2ObjectOpenHashMap (it.unimi.dsi.fastutil.bytes.Byte2ObjectOpenHashMap)1 Int2IntMap (it.unimi.dsi.fastutil.ints.Int2IntMap)1 Int2IntOpenHashMap (it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap)1 Int2ObjectMap (it.unimi.dsi.fastutil.ints.Int2ObjectMap)1 Int2ObjectOpenHashMap (it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap)1 Object2ByteOpenHashMap (it.unimi.dsi.fastutil.objects.Object2ByteOpenHashMap)1 Object2IntOpenHashMap (it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap)1 Object2ShortOpenHashMap (it.unimi.dsi.fastutil.objects.Object2ShortOpenHashMap)1 Short2IntMap (it.unimi.dsi.fastutil.shorts.Short2IntMap)1 Short2IntOpenHashMap (it.unimi.dsi.fastutil.shorts.Short2IntOpenHashMap)1