Bird
0
0

What does the numpy.transpose() function do to an array?

easy📝 Conceptual Q11 of 15
NumPy - Array Manipulation
What does the numpy.transpose() function do to an array?
AIt removes duplicate elements from the array.
BIt adds new elements to the array.
CIt sorts the array elements in ascending order.
DIt swaps or flips the axes of the array.
Step-by-Step Solution
Solution:
  1. Step 1: Understand the purpose of transpose()

    The transpose() function changes the order of axes in an array, effectively flipping or swapping them.
  2. Step 2: Compare with other options

    Adding elements, sorting, or removing duplicates are unrelated to axis swapping.
  3. Final Answer:

    It swaps or flips the axes of the array. -> Option D
  4. Quick Check:

    transpose() = swaps axes [OK]
Quick Trick: Remember: transpose flips axes, not values or elements [OK]
Common Mistakes:
  • Thinking transpose sorts or changes values
  • Confusing transpose with adding or removing elements
  • Assuming transpose only works on 2D arrays

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NumPy Quizzes