Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Polars DataFrame memory size in Python

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.

like image 482
fvg Avatar asked Dec 12 '25 10:12

fvg


1 Answers

Using the polars.DataFrame.estimated_size() method we can get the size of the dataframe similar to pandas.info().

Follow the link.

like image 141
Regular Tech Guy Avatar answered Dec 15 '25 04:12

Regular Tech Guy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!