Was wondering about the size of particular polars DataFrames. I tried with:
from sys import getsizeof
getsizeof(df)
Out[17]: 48
getsizeof(df.to_pandas())
Out[18]: 1602923950
It appears all polars df are 48 bytes? Confused.
Was wondering about the size of particular polars DataFrames. I tried with:
from sys import getsizeof
getsizeof(df)
Out[17]: 48
getsizeof(df.to_pandas())
Out[18]: 1602923950
It appears all polars df are 48 bytes? Confused.
The Python package polars is only a wrapper for the underlying core polars library written in Rust. So I'm pretty sure what you're seeing when you call getsizeof on the DataFrame is the getsizeof result for the Python object implementing that type in the polars Python package (at the wrapper layer).
With pandas the df.info() function will include memory usage. I was actually looking for this in polars as well.
I noticed there are individual functions for getting the null count and the schema (#2492), but I couldn't track down a way to print a DataFrame's memory usage from a polars implementation.
I'll bump this question in the discord. This should be doable to implement if I'm not over-simplifying it.