Maria Sosnovskaya
banner
sosnovskaya.bsky.social
Maria Sosnovskaya
@sosnovskaya.bsky.social
Python Dev
Reposted by Maria Sosnovskaya
If a text column #Python #Pandas data frame uses lots of memory and repeats, make it a category:

df['x'].memory_usage(deep=True)
# result: 8,093,417

df['x'] = df['x'].astype('category')

df['x'].memory_usage(deep=True)
# result: 154,853

A 99% savings!
January 18, 2026 at 4:30 PM
Hi everyone!

I'm Maria Sosnovskaya, Paython dev

It's my first post :)

I hope, I will find a lot of expert content here!

#Python #IAmNewHere
January 18, 2026 at 5:24 PM