Skip to content

Python code snippet – How much memory does a variable need?

from sys import getsizeof
a = 42
getsizeof(a) # size of object in bytes
See also  Python code snippet - How to pick out separate columns from the pandas dataframe object?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.