Get the size of an sframe in bytes

User 2785 | 2/5/2016, 10:20:24 PM

Anyway to get the size of an sframe in bytes? Need that value for bug testing.


User 4 | 2/9/2016, 10:29:32 PM

Hi @wallawalla,

Assuming you have an SFrame named sf, you could run something like this:


make sure the SFrame is written to disk in a known location (otherwise, it may be only partially on disk, fully in RAM, or not yet materialized):'temporarysframeforsize') files = os.listdir('temporarysframeforsize') files = [os.path.join('temporarysframeforsize', f) for f in files] sizeinbytes = sum([os.path.getsize(f) for f in files]) print sizein_bytes `

Once you are done, you can delete the directory "temporarysframefor_size" (it was created in order to measure the size). Note that this will potentially make a copy of the entire SFrame on disk. If you already have an SFrame on disk that you want to check the size of, you can simply use that directory instead, and omit the save.