我想为DataFrame中具有多个值的列添加where条件。
例如,它适用于单个值。
df.where($"type".==="type1" && $"status"==="completed").如何为同一列添加多个值,如下所示。
df.where($"type" IN ("type1","type2") && $"status" IN ("completed","inprogress")发布于 2016-10-24 20:43:38
您要查找的方法是isin
import sqlContext.implicits._
df.where($"type".isin("type1","type2") and $"status".isin("completed","inprogress"))通常,您希望执行以下操作
val types = Seq("type1","type2")
val statuses = Seq("completed","inprogress")
df.where($"type".isin(types:_*) and $"status".isin(statuses:_*))https://stackoverflow.com/questions/40218473
复制相似问题