LinkedIn Python Skill Assessment Quiz Answers

Suppose you have a variable named vector of type np.array with 10.000 elements. How can you turn vector into a variable named matrix with dimensions 100×100?: [ANSWER NEEDED]

Latest Update on 25th January, 2022 by Certification Course Answers

Suppose you have a variable named vector of type np.array with 10.000 elements. How can you turn vector into a variable named matrix with dimensions 100x100?: [ANSWER NEEDED]

  1.  matrix = matrix(vector,100,100)
  2.  matrix = vector.to_matrix(100,100)
  3.  matrix = (vector.shape = (100,100))
  4.  matrix = vector.reshape(100,100)

Correct Answer:

  •  matrix = vector.reshape(100,100)

Example:

import numpy as np
vector = np.random.rand(10000)
matrix = a.reshape(100, 100)
print(matrix.shape)
(100, 100)

Latest Updates

No posts found in this category.