def train_test_split(df, test_ratio):
    """
    Splitting the given dataset to train and test by preserving the order between the samples (it is time series data).
    
    Parameters
    ----------
    df: pandas' DataFrame. The dataset
    test_ratio: float. Indicate the ratio of the test after the split
    """

    train_ratio = 1 - test_ratio
    
    train_last_idx = int(len(df) * train_ratio)
    train_df = df.iloc[train_last_idx:, :].reset_index(drop=True)
    test_df = df.iloc[:train_last_idx, :].reset_index(drop=True)
    
    return train_df, test_df