Skip to content

Instantly share code, notes, and snippets.

View Japkeerat's full-sized avatar
👋
I may be slow to respond.

Japkeerat Singh Japkeerat

👋
I may be slow to respond.
View GitHub Profile
file = 'hotel_bookings.csv'
data = pd.read_csv(file)
def reduce_mem_usage(df): # Unknown Author
numerics = ['int16', 'int32', 'int64', 'float16', 'float32', 'float64']
start_mem = df.memory_usage().sum() / 1024**2
for col in df.columns:
col_type = df[col].dtypes
if col_type in numerics:
c_min = df[col].min()