fastai’s df_shrink: Shrink DataFrame’s Memory Usage in One Line of Code
Changing data types of DataFrame columns to smaller data types can significantly reduce the memory usage of the DataFrame.
Instead of manually choosing smaller data types, is there a way that you can automatically change data types in one line of code?
That is when the df_shrink method of fastai comes in handy. In the code above, the memory usage of the DataFrame decreases from 200 bytes to 146 bytes,
Learn more about df_shrink here.
Link to the source code.
Favorite
fastai’s df_shrink: Shrink DataFrame’s Memory Usage in One Line of Code Read More »