How to clone a two-dimensional numpy array in Python

1 Answer

0 votes
import numpy as np

array2D = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])

cloned_array = np.copy(array2D)

print(cloned_array)


  
'''
run:
  
[[1 2 3]
 [4 5 6]
 [7 8 9]]
  
'''

 



answered Mar 7, 2025 by avibootz

Related questions

2 answers 97 views
1 answer 84 views
3 answers 110 views
1 answer 84 views
1 answer 93 views
1 answer 100 views
100 views asked Mar 8, 2025 by avibootz
3 answers 127 views
...