Question: Assume NumPy is loaded under the alias np . This code initializes and prints array: array = np . array ( [ [ ' a

Assume NumPy is loaded under the alias np. This code initializes and prints array:
array = np.array([['a','a'],['b','b'],['c','c']])
print(array)
[['a''a']
['b''b']
['c''c']]
The following questions modify array and print the result. Fill in the blank to complete the code.
1)
array2= np.______(array,0,'z', axis=1)
print(array2)
[['z''a''a']
['z''b''b']
['z''c''c']]
Check
Show answer
2)
array2= np.insert(array,0,'z',______)
print(array2)
[['z''z']
['a''a']
['b''b']
['c''c']]
Check
Show answer
3)
array2= np.______(array,1, axis=0)
print(array2)
[['a''a']
['c''c']]
Check
Show answer
4)
array2= np.sort(array,____)
print(array2)
['a''a''b''b''c''c']

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!