rejectRows doesn't work


#1

Hi,
I try to run an evalMetrics with 125 expressions. One of these return only 0 and 1 values.
I call it binaryMetric.

After I want to transform the result in dataset and remove all rows where the binaryMetric ==1.

I use the rejectRows function:

var emr = my_type.evalMetrics({
    start: validTimeRange.start,
    end: validTimeRange.end,
    ids:[my_type.asset.id],
    interval: "SECOND",
    expressions: expressions
  });
var res = Dataset.fromEvalMetricsResult(emr).rejectRows(binaryMetric);

what I expect after the last command is something like a dataset composed by 124 columns instead of 125 because the rejectRows drop all rows where the column of binaryMetric == 1 and after drop the column binaryMetric .

But I have all 125 columns.

How I can solve it?

Thanks


#2

Hi,
As the name of the method implies, rejectRows rejects rows… not columns.
I recommend you add a call to the method dropColumns: I will let you figure out what it does.


#3

If I read the documentation about the function I read:

rejectRows(conditionColumn): mixing Dataset

Reject rows where the value in conditionColumn is not zero, and return a new dataset with the filtered values.

Does not mutate the original dataset.

This will also remove the conditionColumn from the returned dataset.

I don’t understand the last 2 rows, the conditionColumn will be drop or not?
If I run the command in console, the conditionColumn is dropped.

I have to use dropColumns method?


#4

Ah, my bad for not reading the documentation completely… :man_shrugging:
Still, maybe you could try to use dropColummns as a workaround?


#5

The problem persists also with dropColummns


#6

Sorry to hear that, it might be a bug. You have to create a support ticket.