📜  使用给定条件过滤行 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:06.758000             🧑  作者: Mango

代码示例1
# Filters rows using the given condition

df.filter(df.age > 3).collect()
# [Row(age=5, name='Bob')]
df.where(df.age == 2).collect()
# Row(age=2, name='Alice')]

df.filter("age > 3").collect()
# [Row(age=5, name='Bob')]
df.where("age = 2").collect()
# [Row(age=2, name='Alice')]