B_Furtado B_Furtado -4 years ago 97
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

Answer Source

Use the copy-method:

b = a.copy()
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download