← Practice
πŸ“– Training, validation and leakageLearning path
Browsing as guestΒ·Sign in or create a free account to save progress and use tutor tools.
LessonΒ·difficulty 2/5Β·~15 min

Split a time-ordered dataset

Implement split_history(rows, train_count).

rows is already ordered oldest to newest. Return [training_rows, test_rows], taking the first train_count rows for training. train_count is an integer in [0, len(rows)]. Keep order and do not modify rows. Return two separate lists.

Before coding, predict one result by hand. After the tests pass, explain your approach and add a boundary example of your own.

Tests

  • Case 1
  • Case 2
  • Case 3
  • Case 4

✦ Stuck? Ask for a spark

Sign in or create a free account to use your monthly AI explainer allowance.

warming up
Loading editor…
Consolewaiting

$ Console output will appear here.

>_AI coach
Sign in or create a free account to chat with the tutor.