Reputation: 1335
I tried to write this
package org.apache.spark.h2o.utils
import water.fvec.{NewChunk, Frame, Chunk}
import water._
class Miss extends MRTask{
override def map(c: Chunk, nc: NewChunk): Unit = {
for (row <- 0 until c.len()) {
if( ){
nc.addNum(1)
}
else
nc.addNum(0)
}
}
}
What can I put in if (...)
to check whether or not there is a null
value in that row?
Upvotes: 0
Views: 171
Reputation: 437
H2O provides Chunk
API which focuses on efficient data processing and internally uses only primitive Java types. Hence, there is no null
check but you can ask for missing value at given row:
if (c.isNA(row)) { ... } else { ... }
or shorter version for your example:
nc.addNum(c.isNA(row) ? 1 : 0)
Upvotes: 1