Skip to main contentSkip to solution

Which of the following is a data aggregate function in the python DataFrame 'df'?

Solution

✅ Correct Option: 1

DataFrame.aggregate() (alias agg()) is pandas' aggregation method. It applies one or more functions, such as 'sum', 'mean' or 'max', along an axis and reduces the data to summary values. So df.aggregate('sum') returns the sum of each column.


Option 3: quantile() is a statistical method that returns the value at a given quantile. It is not the aggregate function method.

Option 2: sorting is not aggregation, and the real method is sort_values(), so sort_value() does not exist.

Option 4: show() is a Spark DataFrame method for displaying rows. pandas has no show().

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question