QuestionQ285

VerifiedDeveloping Apache Spark™ DataFrame/DataSet API Applications

Given the following two DataFrames, df1 and df2:

Question Image

Which code fragment can replace X to perform an inner join on the id and name columns, ensuring both columns match across the DataFrames?

Explanation

A join condition formed by (df1.id == df2.id) & (df1.name == df2.name) requires both equality predicates to be true for a row pair to match. DataFrame.join defaults to an inner join when no join type is specified.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!