Real Python

Get Your Code: Click here to download a California housing example that splits the data with train_test_split(), then fits and scores three models.

Almost there! Complete this form and click the button below to gain instant access:

Split Your Dataset With scikit-learn's train_test_split()

Split the California Housing Data and Score Three Models

๐Ÿ”’ No spam. We take your privacy seriously.

ยฉ 2012โ€“2026 Real Python โ‹… Privacy Policy