In exArray, sort each column along the direction of the rows in ascending order. 1 #Load necessary package 2 import numpy as np 3 4 # Create array 5 exArray = np.array([['n', 'v', 'g', '1', 'z'], ['b', 'y', 'c', 'r', 'f']]) 6 7 # Sort array 8 exArray_sorted np. sort (exArray, axis=0) 9 10 # Print the array 11 print (exArray) Check Next level X 1: Compare output exArray. sort () takes an axis argument that determines along which axis the array should be column along the direction of the rows. Not all tests passed. Output differs. See highlights below. Your output Expected output [['n' ['b' [['g' ['b' 2 1 'V' 1 JC 1 1 I C n T 111 r V 'r 1 'Z'] 'f']] 'z'] 3 1

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter12: Points, Classes, Virtual Functions And Abstract Classes
Section: Chapter Questions
Problem 29SA
icon
Related questions
Question

I am struggling with this problem 

In exArray, sort each column along the direction of the rows in ascending order.
1 # Load necessary package
2 import numpy as np
3
4 # Create array
5 exArray
6
7 # Sort array
8 exArray_sorted
9
10 # Print the array
11 print(exArray)
Check
np.array([['n', 'v', 'g', '1', 'z'], ['b', 'y', 'c', 'r', 'f']])
1
Next level
X 1: Compare output
=
np. sort(exArray, axis=0)
Your output
Expected output
exArray.sort () takes an axis argument that determines along which axis the array should be
column along the direction of the rows.
Not all tests passed.
Output differs. See highlights below.
[['n'
['b'
1
1
2
1
T
V
1
1
1
I
[['g
['b' 'c' 'f'
T
'C'
V
1 'Z']
1
V
1
r'
'f']]
3
V
z']
I' 'y'll
4
Transcribed Image Text:In exArray, sort each column along the direction of the rows in ascending order. 1 # Load necessary package 2 import numpy as np 3 4 # Create array 5 exArray 6 7 # Sort array 8 exArray_sorted 9 10 # Print the array 11 print(exArray) Check np.array([['n', 'v', 'g', '1', 'z'], ['b', 'y', 'c', 'r', 'f']]) 1 Next level X 1: Compare output = np. sort(exArray, axis=0) Your output Expected output exArray.sort () takes an axis argument that determines along which axis the array should be column along the direction of the rows. Not all tests passed. Output differs. See highlights below. [['n' ['b' 1 1 2 1 T V 1 1 1 I [['g ['b' 'c' 'f' T 'C' V 1 'Z'] 1 V 1 r' 'f']] 3 V z'] I' 'y'll 4
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT