Search in sources :

Example 41 with BitmapBackedSelection

use of tech.tablesaw.selection.BitmapBackedSelection in project symja_android_library by axkr.

the class Table method dropRowsWithMissingValues.

/**
 * Returns only those records in this table that have no columns with missing values
 */
public Table dropRowsWithMissingValues() {
    Selection missing = new BitmapBackedSelection();
    for (int row = 0; row < rowCount(); row++) {
        for (int col = 0; col < columnCount(); col++) {
            Column<?> c = column(col);
            if (c.isMissing(row)) {
                missing.add(row);
                break;
            }
        }
    }
    Selection notMissing = Selection.withRange(0, rowCount());
    notMissing.andNot(missing);
    Table temp = emptyCopy(notMissing.size());
    Rows.copyRowsToTable(notMissing, this, temp);
    return temp;
}
Also used : PivotTable(tech.tablesaw.aggregate.PivotTable) BitmapBackedSelection(tech.tablesaw.selection.BitmapBackedSelection) Selection(tech.tablesaw.selection.Selection) BitmapBackedSelection(tech.tablesaw.selection.BitmapBackedSelection)

Example 42 with BitmapBackedSelection

use of tech.tablesaw.selection.BitmapBackedSelection in project symja_android_library by axkr.

the class ExprColumn method isIn.

public Selection isIn(Collection<IExpr> strings) {
    Set<IExpr> stringSet = Sets.newHashSet(strings);
    Selection results = new BitmapBackedSelection();
    for (int i = 0; i < size(); i++) {
        if (stringSet.contains(values.get(i))) {
            results.add(i);
        }
    }
    return results;
}
Also used : BitmapBackedSelection(tech.tablesaw.selection.BitmapBackedSelection) Selection(tech.tablesaw.selection.Selection) IExpr(org.matheclipse.core.interfaces.IExpr) BitmapBackedSelection(tech.tablesaw.selection.BitmapBackedSelection)

Example 43 with BitmapBackedSelection

use of tech.tablesaw.selection.BitmapBackedSelection in project symja_android_library by axkr.

the class ExprColumn method isIn.

public Selection isIn(IExpr... strings) {
    Set<IExpr> stringSet = Sets.newHashSet(strings);
    Selection results = new BitmapBackedSelection();
    for (int i = 0; i < size(); i++) {
        if (stringSet.contains(values.get(i))) {
            results.add(i);
        }
    }
    return results;
}
Also used : BitmapBackedSelection(tech.tablesaw.selection.BitmapBackedSelection) Selection(tech.tablesaw.selection.Selection) IExpr(org.matheclipse.core.interfaces.IExpr) BitmapBackedSelection(tech.tablesaw.selection.BitmapBackedSelection)

Example 44 with BitmapBackedSelection

use of tech.tablesaw.selection.BitmapBackedSelection in project symja_android_library by axkr.

the class LongColumn method isIn.

public Selection isIn(final long... numbers) {
    final Selection results = new BitmapBackedSelection();
    final LongRBTreeSet intSet = new LongRBTreeSet(numbers);
    for (int i = 0; i < size(); i++) {
        if (intSet.contains(getLong(i))) {
            results.add(i);
        }
    }
    return results;
}
Also used : BitmapBackedSelection(tech.tablesaw.selection.BitmapBackedSelection) Selection(tech.tablesaw.selection.Selection) BitmapBackedSelection(tech.tablesaw.selection.BitmapBackedSelection)

Example 45 with BitmapBackedSelection

use of tech.tablesaw.selection.BitmapBackedSelection in project symja_android_library by axkr.

the class LongColumn method isNotIn.

public Selection isNotIn(final long... numbers) {
    final Selection results = new BitmapBackedSelection();
    results.addRange(0, size());
    results.andNot(isIn(numbers));
    return results;
}
Also used : BitmapBackedSelection(tech.tablesaw.selection.BitmapBackedSelection) Selection(tech.tablesaw.selection.Selection) BitmapBackedSelection(tech.tablesaw.selection.BitmapBackedSelection)

Aggregations

BitmapBackedSelection (tech.tablesaw.selection.BitmapBackedSelection)79 Selection (tech.tablesaw.selection.Selection)79 IntArrayList (it.unimi.dsi.fastutil.ints.IntArrayList)31 PivotTable (tech.tablesaw.aggregate.PivotTable)3 ByteOpenHashSet (it.unimi.dsi.fastutil.bytes.ByteOpenHashSet)2 IntIterator (it.unimi.dsi.fastutil.ints.IntIterator)2 IntOpenHashSet (it.unimi.dsi.fastutil.ints.IntOpenHashSet)2 ShortOpenHashSet (it.unimi.dsi.fastutil.shorts.ShortOpenHashSet)2 IExpr (org.matheclipse.core.interfaces.IExpr)2 ByteArrayList (it.unimi.dsi.fastutil.bytes.ByteArrayList)1 ByteIterator (it.unimi.dsi.fastutil.bytes.ByteIterator)1 IntRBTreeSet (it.unimi.dsi.fastutil.ints.IntRBTreeSet)1 ByteBuffer (java.nio.ByteBuffer)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 CategoricalColumn (tech.tablesaw.api.CategoricalColumn)1 DoubleColumn (tech.tablesaw.api.DoubleColumn)1 Column (tech.tablesaw.columns.Column)1