Iterate rows and columns in Spark dataframe
Consider you have a Dataframe like below +—–+——+—+ | name|sector|age| +—–+——+—+ | Andy| aaa| 20| |Berta| bbb| 30| | Joe| ccc| 40| +—–+——+—+ To loop your Dataframe and extract the elements from the Dataframe, you can either chose one of the below approaches. Approach 1 – Loop using foreach Looping a dataframe directly using foreach … Read more