def data_split(data, frac_validate=.2, frac_test=.2):
  """
  Split data into train, validatio, train2 and test set.

  Args:
    data (array or series): data of interest
    frac_valid (float): a fraction of data for validation set (default = 0.2)
    frac_test (float): a fraction of data for test set (default = 0.2)

  Returns:
    a tuple of 4 dataframe including train, train2, valid, and test.
  """

  n_size  = data.shape[0]
  n_test  = int(n_size*(frac_test))
  n_validate = int(n_size*(frac_validate))
  n_train = n_size - n_test - n_validate
  
  train  = data.iloc[:n_train].dropna()
  validate  = data.iloc[n_train:-n_test]
  train2 = data.iloc[:-n_test]
  test   = data.iloc[-n_test:]

  return train, validate, train2, test