def split_dataframe(df, size=10*1024*1024):
    """Splits huge dataframes(CSVs) into smaller segments of given size in bytes"""
    
    # size of each row
    row_size = df.memory_usage().sum() / len(df)
    # maximum number of rows in each segment
    row_limit = int(size // row_size)
    # number of segments
    seg_num = (len(df)+row_limit-1)//row_limit
    # split df into segments
    segments = [df.iloc[i*row_limit : (i+1)*row_limit] for i in range(seg_num)]

    return segments