Skip to content

Instantly share code, notes, and snippets.

@admond1994
Created January 11, 2019 13:28
Show Gist options
  • Select an option

  • Save admond1994/1fdfa6bf6e6c1899044683508c768468 to your computer and use it in GitHub Desktop.

Select an option

Save admond1994/1fdfa6bf6e6c1899044683508c768468 to your computer and use it in GitHub Desktop.
def change_dtypes(col_int, col_float, df):
'''
AIM -> Changing dtypes to save memory
INPUT -> List of column names (int, float), df
OUTPUT -> updated df with smaller memory
------
'''
df[col_int] = df[col_int].astype('int32')
df[col_float] = df[col_float].astype('float32')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment