1# Filters rows using the given condition
2
3df.filter(df.age > 3).collect()
4# [Row(age=5, name='Bob')]
5df.where(df.age == 2).collect()
6# Row(age=2, name='Alice')]
7
8df.filter("age > 3").collect()
9# [Row(age=5, name='Bob')]
10df.where("age = 2").collect()
11# [Row(age=2, name='Alice')]