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

Advertisement
Advertisement