Bird
0
0

What does setting axis=0 do when aggregating a 2D NumPy array?

easy📝 Conceptual Q11 of 15
NumPy - Aggregation Functions
What does setting axis=0 do when aggregating a 2D NumPy array?
AAggregates values down each column (per column)
BAggregates values across each row (per row)
CFlattens the array before aggregation
DAggregates only the diagonal elements
Step-by-Step Solution
Solution:
  1. Step 1: Understand axis parameter meaning

    In NumPy, axis=0 means aggregation happens down the rows, combining values in each column.
  2. Step 2: Apply to 2D array

    Aggregating with axis=0 summarizes each column separately.
  3. Final Answer:

    Aggregates values down each column (per column) -> Option A
  4. Quick Check:

    axis=0 means down rows = per column aggregation [OK]
Quick Trick: axis=0 aggregates columns, axis=1 aggregates rows [OK]
Common Mistakes:
  • Confusing axis=0 with axis=1
  • Thinking axis=0 aggregates rows instead of columns
  • Assuming axis=0 flattens the array

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NumPy Quizzes