def time_series_split(X, test_size=0.2, number=False, output_numpy=True):
    """
    Splits a dataset according to the time the data was taken
    :param X:
    :param test_size:
    :param output_numpy:
    :return:
    """
    if test_size <= 1 and not number:
        ntrn = int(len(X) * (1 - test_size))
    elif test_size > 1 and number:
        ntrn = int(len(X) - test_size)
    else:
        raise ValueError(
            'test_size: (frac or Int) and number:(True or False) should be set correctly'
            )
    X_train = X[0:ntrn]
    X_test = X[ntrn:]
    return X_train, X_test
