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 132 views
1 answer 103 views
3 answers 132 views
1 answer 101 views
1 answer 108 views
1 answer 120 views
120 views asked Mar 8, 2025 by avibootz
3 answers 146 views
...