I'm using numpy.array to process a big matrix (about 20000*20000), I have a question in exploring the memory usage of arrays.
>>> a = np.random.random((5,5))
>>> np.savetxt(fname = path, X = a)
>>> b = np.loadtxt(fname = path)
>>> b
array([[0.17940875, 0.33674265, 0.14397669, 0.49947964, 0.70878022],
[0.88072205, 0.69542991, 0.6094819 , 0.47855311, 0.73319366],
[0.75855104, 0.79885525, 0.77966685, 0.3756036 , 0.81272082],
[0.754227 , 0.07242963, 0.16935453, 0.76840836, 0.10537832],
[0.74316004, 0.76265098, 0.7661815 , 0.22217968, 0.32509482]])
>>> a
array([[0.17940875, 0.33674265, 0.14397669, 0.49947964, 0.70878022],
[0.88072205, 0.69542991, 0.6094819 , 0.47855311, 0.73319366],
[0.75855104, 0.79885525, 0.77966685, 0.3756036 , 0.81272082],
[0.754227 , 0.07242963, 0.16935453, 0.76840836, 0.10537832],
[0.74316004, 0.76265098, 0.7661815 , 0.22217968, 0.32509482]])
>>> a.__sizeof__()
312
>>> b.__sizeof__()
112
>>> a.dtype
dtype('float64')
>>> b.dtype
dtype('float64')
>>>
So, why the memory of var a is 312 and that of var b is 112?