Preprocess¶
_split ¶
train_test_split ¶
Split the DataFrame into train and test sets sequentially (Time Series Split).
The split index is int(len(df) * train_size): the first that many rows go
to train, the rest to test. Both splits keep the original time_col, freq
and name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
Input DataFrame. |
required |
train_size
|
float
|
Proportion of the dataset to include in the train split, exclusive (0, 1). Note that on very small inputs the floor can make train empty (e.g. 1 row with train_size=0.7 -> 0 train rows); test is always non-empty since train_size < 1. |
0.7
|
Returns:
| Type | Description |
|---|---|
tuple[DataFrame, DataFrame]
|
(Train DataFrame, Test DataFrame) |
Source code in ctalearn/preprocess/_split.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |