Using deepcopy() or copy() is a good solution.
For a simple 2D-array case
y = [row[:] for row in x]
More Related Contents:
- What is the difference between shallow copy, deepcopy and normal assignment operation?
- How can I create a copy of an object in Python?
- How do you programmatically set an attribute?
- Sorting arrays in NumPy by column
- Saving and loading multiple objects in pickle file?
- Pandas: Chained assignments [duplicate]
- How to access the ith column of a NumPy multidimensional array?
- Python/NumPy first occurrence of subarray
- Concatenating two one-dimensional NumPy arrays
- Numpy matrix to array
- How can I add new dimensions to a Numpy array?
- Force NumPy ndarray to take ownership of its memory in Cython
- How to normalize a NumPy array to within a certain range?
- subsampling every nth entry in a numpy array
- What does [:] mean?
- Check if two 3D numpy arrays contain overlapping 2D arrays
- Shortest way to slice even/odd lines from a python array?
- How to copy worksheet from one workbook to another one using openpyxl?
- What is this kind of assignment in Python called? a = b = True
- Retrieving JSON objects from a text file (using Python)
- Repeat each values of an array different times
- How to create 2d array with numpy random.choice for every rows?
- How to hash a string into 8 digits?
- “_set” in a queryset object in Django
- Numpy Vector (N,1) dimension -> (N,) dimension conversion
- Fast way to copy dictionary in Python
- Python: Elegant and efficient ways to mask a list
- Efficient dot products of large memory-mapped arrays
- How can two Python objects have same id but ‘is’ operator returns False?
- SWIG/python array inside structure