Compare specific rows of DataFrames in Scala

108 Views Asked by At

I have two Scala DataFrames which I am testing for similarities. I want to be able to pick a specific row number, and compare each value of that row between the two DataFrames. For example:

Dataframe 1: df1

+------+-----+-----------+
| Name | Age | Eye Color |
+------+-----+-----------+
| Bob  | 12  |   Blue    |
| Bil  | 17  |   Red     |
| Ron  | 13  |   Brown   |
+------+-----+-----------+

Dataframe 2: df2

+------+-----+-----------+
| Name | Age | Eye Color |
+------+-----+-----------+
| Bob  | 12  |   Blue    |
| Bil  | 14  |   Blue    |
| Ron  | 13  |   Brown   |
+------+-----+-----------+

Input: Row 2, output: Age, Eye Color.

What would be ideal, is for the output to show the values that are different too. I have considered the option here but the issue is that my DataFrames are very large (in excess of 200,000 rows) so this takes far too long. Is there a simpler way to select a specific row value of a Dataframe in Scala?

0

There are 0 best solutions below