2

If I had two different arrays with different dimensions like the following:

loaded_data = np.arange(4674).reshape(57, 41, 2)
final_data = np.zeros((60, 41, 2))

How would I most efficiently update final_data with the values from Loaded_data leaving the additional columns with zero value?

1 Answer 1

3

You can use array slicing to do the update

final_data[:loaded_data.shape[0]] = loaded_data
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.