Learn practical skills, build real-world projects, and advance your career

Memory

import numpy as np
import sys

ls = [1,2,3,4]
np_arr = np.array(ls)

print("Memory Consumed by Lists: ", sys.getsizeof(ls), "Bytes")
print("Memory Consumed by NumPy: ", np_arr.itemsize*np_arr.size, "Bytes")
Memory Consumed by Lists: 96 Bytes Memory Consumed by NumPy: 16 Bytes

Pointers

  • ==: Equality Operator
  • is: Identity Operator
ls
[1, 2, 3, 4]
np_arr
array([1, 2, 3, 4])