'Reduce float precission to save memory in Python

I am preparing a code to create an array of 10^5 rows and 10^4 columns with Python. Each element of the array is a float (1.504096744947185, e.g.), which takes 24 Bytes, so the whole array would need 24 GB. However, I only need a precision of 6 decimal places instead of the default 15 decimal places given by Python. I have tried the round function, but it doesn't really save memory.

Would it be possible to reduce the precision of the numbers to save memory?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source