QuestionQ71

VerifiedUsing Pandas API on Spark

A Developer is working with a pandas DataFrame that contains user-behavior data from a web application.

Which approach should be used to execute a groupby operation in parallel across all Apache Spark 3.5 workers?

Explanation

GroupedData.applyInPandas implements grouped-map processing: Spark splits the data by the grouping key, applies the pandas function to each complete group in parallel, and combines the returned pandas DataFrames into a Spark DataFrame. mapInPandas processes partition-level batches, so it does not provide group-level aggregation semantics when a key spans partitions.

Learn more

Community Discussion

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