Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Python Numpy Array Fill in the blank

Fill in section A to complete code that will cause the following output:

import numpy as np
j = np.random.random([2,2])
print (j)
print (_A_)

Output:

[[ 0.1624438 , 0.14157016],
[ 0.07818402, 0.85854546]]
[[ 1. , 1. ],
[ 0.48129886, 6.06445229]])

I tried using np.corrcoef, it gives me all values as 1. Can you please help me?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

For your example I am taking exact same j to make you understand.

j=np.array([[ 0.1624438 , 0.14157016],
            [ 0.07818402, 0.85854546]])

print(j)

array([[0.1624438 , 0.14157016],
       [0.07818402, 0.85854546]])

A = j/j[0]
print(A)

array([[1.        , 1.        ],
       [0.48129889, 6.06445214]])

So, A will be j/j[0]

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading