What is the role of 'shuffle' in train_test_split()? Wondering what shuffle does if I set it to True when splitting a dataset into train and test splits. Can I use shuffle on a dataset which is ordered by dates?
train, test = train_test_split(df, test_size=0.2, random_state=42, shuffle=True)

Example dataframe:


Omitting shuffle on a time-sorted DataFrame would lead to a time-based bias where similar periods are in the same dataset. By toggling shuffle=True you make sure that that the data is mixed prior to creation of test/train datasets.
