B_Furtado B_Furtado - 10 months ago 48
Python Question

What is the equivalent of list when using numpy?

When I want to copy a list without linking to the same object I have to call list. So:

a = [1, 2, 3]
b = list(a)

a == b

a is b

What would be the equivalent when I have a numpy array

import numpy
a = numpy.ones(4)

b = XXX(a)?

Thanks in advance


Use the copy-method:

b = a.copy()