Skip to content

Instantly share code, notes, and snippets.

@xtrmstep
Created August 12, 2022 05:35
Show Gist options
  • Save xtrmstep/9d3e4315b941417b2549c1ef83acfe54 to your computer and use it in GitHub Desktop.
Save xtrmstep/9d3e4315b941417b2549c1ef83acfe54 to your computer and use it in GitHub Desktop.
Memory consumption during adding a new column in Pandas DataFrame

A glance under the hood to what happens in memory when you do operations upon Pandas DataFrame and its columns. In monitoring I’ll use the library memory_profiler and use it in Jupyter Notebook as described here.

Since the module is using Python scripts its usage a little bit wired. The general approach is to create a method which I want to profile and execute it by means of magic code %mprun.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment