QuestionQ212

VerifiedDeveloping Apache Spark™ DataFrame/DataSet API Applications

A Data Analyst is working with employees_df and needs to obtain a list of employees with five or more years of tenure for recognition.

Which code snippet filters and displays the list of employees that meet the criteria?

Explanation

DataFrame.filter() returns rows that satisfy a Boolean condition, and collect() retrieves those filtered rows as a list of Row objects. Applying employees_df.tenure >= 5 therefore produces the employee list with tenure of at least five years.

Learn more

Community Discussion

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