DataFrame条件查询,filter,where算子

亲测可用
字符串类型过滤
people.filter(" gender = 'male' ").count
people.filter(" gender != 'female' ").count
或者
people.filter($"gender"  ===  "male").count
people.filter($"gender" !== "female").count

数值类型过滤
people.filter($"age" > 25).show
people.filter(" age > 25 ").show
或者
people.where($"age" > 25).show
people.where("age  >  25").show
people.where($"age" > 25 && $"gender" === "male").show

你可能感兴趣的:(DataFrame条件查询,filter,where算子)