Skip to content

Instantly share code, notes, and snippets.

@Magnus167
Last active January 26, 2023 16:24
Show Gist options
  • Select an option

  • Save Magnus167/a110c1537d8a158cded7733ece129bb3 to your computer and use it in GitHub Desktop.

Select an option

Save Magnus167/a110c1537d8a158cded7733ece129bb3 to your computer and use it in GitHub Desktop.
printing memory used/size in bytes of a pandas dataframe
import pandas as pd
from typing import *
df : pandas.Dataframe = some_stuff()
print(f"Size of dataframe: {df.memory_usage().sum() / 1024**2:.2f} MB")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment