# Applies the f function to all Row def f(person): print(person.name) df.foreach(f)
Here is what the above code is Doing:
1. It creates a function f that takes a Row object as input.
2. It prints the name of the person.
3. It applies the function f to all the rows in the DataFrame.