I think the exception is caused because you used the keyword Count.
Now when you use the filter function, in the background it's actually SQL code running. So count being a keyword in SQL is misinterpreted here.
You can either specify it as a column by using $ sign
df.groupBy("travel").count()
.filter($"count >= 1000")
.show()
Alternatively, you can use the rename function also
df.groupBy("travel").count().withColumnRenamed("count", "x")
.filter("x >= 1000")
.show()
Hope this helps!!
If you need to learn more about Scala, It's recommended to join Scala Certification course today.
Thank you!