Last active
July 18, 2020 06:53
-
-
Save ranpelta/cf1b0cf219a49f93e58942d525494f45 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test_size = int(len(df) * 0.1) # the test data will be 10% (0.1) of the entire data | |
train = df.iloc[:-test_size,:].copy() | |
# the copy() here is important, it will prevent us from getting: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_index,col_indexer] = value instead | |
test = df.iloc[-test_size:,:].copy() | |
print(train.shape, test.shape) | |
>>> ((28916, 4), (3212, 4)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment