Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tkazusa
tkazusa / reduce_mem_usage.py
Last active December 24, 2022 12:51
load data (reduce memory usage)
"""
load data(reduce memory usage)
https://www.kaggle.com/gemartin/load-data-reduce-memory-usage
"""
import pandas as pd
import numpy as np
def reduce_mem_usage(df):
""" iterate through all the columns of a dataframe and modify the data type