Copying, Sorting, and Comparison

Learn about the usage of copying, sorting, and comparison operations using the Numpy library.

Copying and sorting

There are three possible copy operations:

  • No copy
  • Shallow copy operation
  • Deep copy operation

No copy

In a no copy, neither the object nor its data get copied. Only the address of the array is assigned to a variable.

Shallow copy

In a shallow copy, a new array object is created, but it points to the same data as the old array object.

Deep copy

In a deep copy, a new array object is created and copies the old object’s attributes and data in it.

Get hands-on with 1400+ tech skills courses.