QuestionQ138

VerifiedData Processing

A data scientist is refactoring pandas DataFrame code to use the pandas API on Spark.

They have the following incomplete code block:

Question Image

Which line of code can fill the blank and successfully refactor the code to use the pandas API on Spark?

Explanation

The pandas API on Spark is exposed through the pyspark.pandas namespace. Importing it as ps makes ps.read_parquet(path) create a pandas-on-Spark DataFrame, while retaining familiar pandas-style operations such as value_counts().

Learn more

Community Discussion

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