Skip to content

Instantly share code, notes, and snippets.

@kperry2215
Created January 4, 2020 23:34
Show Gist options
  • Save kperry2215/d91cba02da5d4f89248331e90103d20a to your computer and use it in GitHub Desktop.
Save kperry2215/d91cba02da5d4f89248331e90103d20a to your computer and use it in GitHub Desktop.
def time_series_train_test_split(time_series, train_split_fraction):
"""
Split the data into training and test set.
"""
split_index = int(round(time_series.shape[0]*train_split_fraction, 0))
train_set = time_series[:split_index]
test_set = time_series[:-split_index]
return train_set, test_set
### EXECUTE IN MAIN FUNCTION ###
training_set, test_set = time_series_train_test_split(time_series = df['Geothermal_net_generation'],
train_split_fraction = .75)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment