%matplotlib inline
%config InlineBackend.figure_format='retina'from __future__ import absolute_import, division, print_function
import matplotlib as mpl
from matplotlib import pyplot as plt
from matplotlib.pyplot import GridSpec
import seaborn as sns
import numpy as np
import pandas as pd
import os, sys
from tqdm import tqdm
import warnings
warnings.filterwarnings('ignore')
sns.set_context("poster", font_scale=1.3)import missingno as msno
import pandas_profiling
from sklearn.datasets import make_blobs
import time
defsave_subgroup(dataframe, g_index, subgroup_name, prefix='raw_'):
save_subgroup_filename ="".join([prefix, subgroup_name,".csv.gz"])
dataframe.to_csv(save_subgroup_filename, compression='gzip', encoding='UTF-8')
test_df = pd.read_csv(save_subgroup_filename, compression='gzip', index_col=g_index, encoding='UTF-8')# Test that we recover what we send inif dataframe.equals(test_df):print("Test-passed: we recover the equivalent subgroup dataframe.")else:print("Warning -- equivalence test!!! Double-check.")