René's URL Explorer Experiment


Title: Split Your Dataset With scikit-learn's train_test_split() – Real Python

Open Graph Title: Split Your Dataset With scikit-learn's train_test_split() – Real Python

Description: In this tutorial, you'll learn why splitting your dataset in supervised machine learning is important and how to do it with train_test_split() from scikit-learn.

Open Graph Description: In this tutorial, you'll learn why splitting your dataset in supervised machine learning is important and how to do it with train_test_split() from scikit-learn.

Mail addresses
?subject=Python article for you&body=Split Your Dataset With scikit-learn's train_test_split() on Real Python https://realpython.com/train-test-split-python-data/

Opengraph URL: https://realpython.com/train-test-split-python-data/

X: @realpython

direct link

Domain: realpython.com


Hey, it has json ld scripts:
{
  "@context": "http://schema.org",
  "@type": "Article",
  "headline": "Split Your Dataset With scikit-learn's train_test_split()",
  "image": {
    "@type": "ImageObject",
    "url": "https://files.realpython.com/media/Splitting-Datasets-With-sklearns-train_test_split_Watermarked.13dcac93b15d.jpg",
    "width": 1920,
    "height": 1080
  },
  "mainEntityOfPage": {
    "@type": "WebPage",
    "@id": "https://realpython.com/train-test-split-python-data/",
    "lastReviewed": "2025-01-29",
    "author": {
      "@type": "Person",
      "name": "Mirko Stojiljkovi\u0107",
      "image": "https://realpython.com/cdn-cgi/image/width=240,height=240,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/ms.fdcd0bdc2f4a.png",
      "url": "https://realpython.com/team/mstojiljkovic/",
      "affiliation": {
        "@type": "Organization",
        "@id": "https://realpython.com/#organization",
        "name": "Real Python",
        "url": "https://realpython.com",
        "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
      }
    },
    "reviewedBy": [
      {
        "@type": "Person",
        "name": "Aldren Santos",
        "image": "https://realpython.com/cdn-cgi/image/width=500,height=500,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/Aldren_Santos_Real_Python.6b0861d8b841.png",
        "url": "https://realpython.com/team/asantos/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Brenda Weleschuk",
        "image": "https://realpython.com/cdn-cgi/image/width=320,height=320,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/IMG_3324_1.50b309355fc1.jpg",
        "url": "https://realpython.com/team/bweleschuk/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Geir Arne Hjelle",
        "image": "https://realpython.com/cdn-cgi/image/width=800,height=800,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/gahjelle.470149ee709e.jpg",
        "url": "https://realpython.com/team/gahjelle/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Joanna Jablonski",
        "image": "https://realpython.com/cdn-cgi/image/width=800,height=800,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/jjablonksi-avatar.e37c4f83308e.jpg",
        "url": "https://realpython.com/team/jjablonski/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Jacob Schmitt",
        "image": "https://realpython.com/cdn-cgi/image/width=400,height=400,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/profile-small_js.2f4d0d8da1ca.jpg",
        "url": "https://realpython.com/team/jschmitt/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Kyle Stratis",
        "image": "https://realpython.com/cdn-cgi/image/width=400,height=400,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/KEK9iuEG_400x400.28b60a4581c0.jpg",
        "url": "https://realpython.com/team/kstratis/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Martin Breuss",
        "image": "https://realpython.com/cdn-cgi/image/width=456,height=456,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/martin_breuss_python_square.efb2b07faf9f.jpg",
        "url": "https://realpython.com/team/mbreuss/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      }
    ]
  },
  "datePublished": "2025-01-29T14:00:00+00:00",
  "dateModified": "2025-01-29T14:09:23.603078+00:00",
  "publisher": {
    "@type": "Organization",
    "@id": "https://realpython.com/#organization",
    "name": "Real Python",
    "url": "https://realpython.com",
    "logo": {
      "@type": "ImageObject",
      "url": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png",
      "width": 512,
      "height": 512
    },
    "description": "Real Python is a leading provider of online Python education and one of the largest language-specific online communities for software developers. It publishes high-quality learning resources, such as tutorials, books, and courses to an audience of millions of developers, data scientists, and machine learning engineers each month.",
    "slogan": "Become a Python Expert",
    "email": "info@realpython.com",
    "sameAs": [
      "https://github.com/realpython",
      "https://www.youtube.com/realpython",
      "https://twitter.com/realpython",
      "https://x.com/realpython",
      "https://www.linkedin.com/company/realpython-com/",
      "https://www.facebook.com/learnrealpython",
      "https://www.instagram.com/realpython",
      "https://www.tiktok.com/@realpython.com"
    ]
  },
  "author": {
    "@type": "Person",
    "name": "Mirko Stojiljkovi\u0107",
    "image": "https://realpython.com/cdn-cgi/image/width=240,height=240,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/ms.fdcd0bdc2f4a.png",
    "url": "https://realpython.com/team/mstojiljkovic/",
    "affiliation": {
      "@type": "Organization",
      "@id": "https://realpython.com/#organization",
      "name": "Real Python",
      "url": "https://realpython.com",
      "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
    }
  },
  "description": "In this tutorial, you'll learn why splitting your dataset in supervised machine learning is important and how to do it with train_test_split() from scikit-learn.",
  "hasPart": {
    "@type": "FAQPage",
    "mainEntity": [
      {
        "@type": "Question",
        "name": "What is train_test_split()?",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "

train_test_split() is a function from scikit-learn that you use to split your dataset into training and test subsets, which helps you perform unbiased model evaluation and validation.

" } }, { "@type": "Question", "name": "What do x_train and y_train mean?", "acceptedAnswer": { "@type": "Answer", "text": "

x_train and y_train are the parts of your dataset that you use to train—or fit—your machine learning model. x_train contains the input data, while y_train contains the corresponding output labels.

" } }, { "@type": "Question", "name": "What does test_size=0.2 mean?", "acceptedAnswer": { "@type": "Answer", "text": "

When you set test_size=0.2 in train_test_split(), you specify that 20% of your dataset should be used as the test set for evaluating your model, with the remaining 80% used for training.

" } }, { "@type": "Question", "name": "Can train_test_split() handle imbalanced datasets?", "acceptedAnswer": { "@type": "Answer", "text": "

Yes, train_test_split() can handle imbalanced datasets by using the stratify parameter, which ensures that the class distribution in the training and test sets matches the original dataset.

" } } ] } }

authorReal Python
twitter:cardsummary_large_image
twitter:imagehttps://files.realpython.com/media/Splitting-Datasets-With-sklearns-train_test_split_Watermarked.13dcac93b15d.jpg
og:imagehttps://files.realpython.com/media/Splitting-Datasets-With-sklearns-train_test_split_Watermarked.13dcac93b15d.jpg
twitter:creator@realpython
og:typearticle

Links:

https://realpython.com/
Start Herehttps://realpython.com/start-here/
Learn Python https://realpython.com/train-test-split-python-data/
Python Tutorials →In-depth articles and video courseshttps://realpython.com/search?kind=article&kind=course&order=newest
Learning Paths →Guided study plans for accelerated learninghttps://realpython.com/learning-paths/
Quizzes & Exercises →Check your learning progresshttps://realpython.com/quizzes/
Browse Topics →Focus on a specific area or skill levelhttps://realpython.com/tutorials/all/
Community Chat →Learn with other Pythonistashttps://realpython.com/community/
Office Hours →Live Q&A calls with Python expertshttps://realpython.com/office-hours/
Podcast →Hear what’s new in the world of Pythonhttps://realpython.com/podcasts/rpp/
Books →Round out your knowledge and learn offlinehttps://realpython.com/products/books/
Reference →Concise definitions for common Python termshttps://realpython.com/ref/
Code Mentor →BetaPersonalized code assistance & learning toolshttps://realpython.com/mentor/
Unlock All Content →https://realpython.com/account/join/
More https://realpython.com/train-test-split-python-data/
Learner Storieshttps://realpython.com/learner-stories/
Python Newsletterhttps://realpython.com/newsletter/
Python Job Boardhttps://www.pythonjobshq.com
Meet the Teamhttps://realpython.com/team/
Become a Tutorial Writerhttps://realpython.com/write-for-us/
Become a Video Instructorhttps://realpython.com/become-an-instructor/
Searchhttps://realpython.com/search
https://realpython.com/search
Joinhttps://realpython.com/account/join/
Sign‑Inhttps://realpython.com/account/login/?next=%2Ftrain-test-split-python-data%2F
Browse Topicshttps://realpython.com/tutorials/all/
Guided Learning Pathshttps://realpython.com/learning-paths/
Basicshttps://realpython.com/search?level=basics
Intermediatehttps://realpython.com/search?level=intermediate
Advancedhttps://realpython.com/search?level=advanced
aihttps://realpython.com/tutorials/ai/
algorithmshttps://realpython.com/tutorials/algorithms/
apihttps://realpython.com/tutorials/api/
best-practiceshttps://realpython.com/tutorials/best-practices/
careerhttps://realpython.com/tutorials/career/
communityhttps://realpython.com/tutorials/community/
databaseshttps://realpython.com/tutorials/databases/
data-sciencehttps://realpython.com/tutorials/data-science/
data-structureshttps://realpython.com/tutorials/data-structures/
data-vizhttps://realpython.com/tutorials/data-viz/
devopshttps://realpython.com/tutorials/devops/
djangohttps://realpython.com/tutorials/django/
dockerhttps://realpython.com/tutorials/docker/
editorshttps://realpython.com/tutorials/editors/
flaskhttps://realpython.com/tutorials/flask/
front-endhttps://realpython.com/tutorials/front-end/
gamedevhttps://realpython.com/tutorials/gamedev/
guihttps://realpython.com/tutorials/gui/
machine-learninghttps://realpython.com/tutorials/machine-learning/
newshttps://realpython.com/tutorials/news/
numpyhttps://realpython.com/tutorials/numpy/
projectshttps://realpython.com/tutorials/projects/
pythonhttps://realpython.com/tutorials/python/
stdlibhttps://realpython.com/tutorials/stdlib/
testinghttps://realpython.com/tutorials/testing/
toolshttps://realpython.com/tutorials/tools/
web-devhttps://realpython.com/tutorials/web-dev/
web-scrapinghttps://realpython.com/tutorials/web-scraping/
Table of Contentshttps://realpython.com/train-test-split-python-data/#toc
The Importance of Data Splittinghttps://realpython.com/train-test-split-python-data/#the-importance-of-data-splitting
Training, Validation, and Test Setshttps://realpython.com/train-test-split-python-data/#training-validation-and-test-sets
Underfitting and Overfittinghttps://realpython.com/train-test-split-python-data/#underfitting-and-overfitting
Prerequisites for Using train_test_split()https://realpython.com/train-test-split-python-data/#prerequisites-for-using-train_test_split
Application of train_test_split()https://realpython.com/train-test-split-python-data/#application-of-train_test_split
Supervised Machine Learning With train_test_split()https://realpython.com/train-test-split-python-data/#supervised-machine-learning-with-train_test_split
Minimalist Example of Linear Regressionhttps://realpython.com/train-test-split-python-data/#minimalist-example-of-linear-regression
Regression Examplehttps://realpython.com/train-test-split-python-data/#regression-example
Classification Examplehttps://realpython.com/train-test-split-python-data/#classification-example
Other Validation Functionalitieshttps://realpython.com/train-test-split-python-data/#other-validation-functionalities
Conclusionhttps://realpython.com/train-test-split-python-data/#conclusion
Frequently Asked Questionshttps://realpython.com/train-test-split-python-data/#frequently-asked-questions
https://realpython.com/feedback/survey/article/train-test-split-python-data/liked/?from=article-sidebar
https://realpython.com/feedback/survey/article/train-test-split-python-data/disliked/?from=article-sidebar
Splitting Datasets With scikit-learn and train_test_split() 33m · 12 lessons https://realpython.com/courses/splitting-datasets-scikit-learn-train-test-split/
Mirko Stojiljkovićhttps://realpython.com/train-test-split-python-data/#author
https://realpython.com/train-test-split-python-data/#reader-comments
intermediatehttps://realpython.com/tutorials/intermediate/
data-sciencehttps://realpython.com/tutorials/data-science/
machine-learninghttps://realpython.com/tutorials/machine-learning/
numpyhttps://realpython.com/tutorials/numpy/
The Importance of Data Splittinghttps://realpython.com/train-test-split-python-data/#the-importance-of-data-splitting
Training, Validation, and Test Setshttps://realpython.com/train-test-split-python-data/#training-validation-and-test-sets
Underfitting and Overfittinghttps://realpython.com/train-test-split-python-data/#underfitting-and-overfitting
Prerequisites for Using train_test_split()https://realpython.com/train-test-split-python-data/#prerequisites-for-using-train_test_split
Application of train_test_split()https://realpython.com/train-test-split-python-data/#application-of-train_test_split
Supervised Machine Learning With train_test_split()https://realpython.com/train-test-split-python-data/#supervised-machine-learning-with-train_test_split
Minimalist Example of Linear Regressionhttps://realpython.com/train-test-split-python-data/#minimalist-example-of-linear-regression
Regression Examplehttps://realpython.com/train-test-split-python-data/#regression-example
Classification Examplehttps://realpython.com/train-test-split-python-data/#classification-example
Other Validation Functionalitieshttps://realpython.com/train-test-split-python-data/#other-validation-functionalities
Conclusionhttps://realpython.com/train-test-split-python-data/#conclusion
Frequently Asked Questionshttps://realpython.com/train-test-split-python-data/#frequently-asked-questions
Remove adshttps://realpython.com/account/join/
Splitting Datasets With scikit-learn and train_test_split()https://realpython.com/courses/splitting-datasets-scikit-learn-train-test-split/
sklearn.model_selectionhttps://scikit-learn.org/stable/api/sklearn.model_selection.html
Click here to download the free sample codehttps://realpython.com/bonus/train-test-split-python-data-code/
https://realpython.com/quizzes/train-test-split-python-data/
Split Your Dataset With scikit-learn's train_test_split()https://realpython.com/quizzes/train-test-split-python-data/
https://realpython.com/train-test-split-python-data/#the-importance-of-data-splitting
Supervised machine learninghttps://en.wikipedia.org/wiki/Supervised_learning
regression analysishttps://realpython.com/linear-regression-in-python/#regression
coefficient of determinationhttps://en.wikipedia.org/wiki/Coefficient_of_determination
root mean square errorhttps://en.wikipedia.org/wiki/Root-mean-square_deviation
mean absolute errorhttps://en.wikipedia.org/wiki/Mean_absolute_error
classificationhttps://realpython.com/logistic-regression-python/#classification
accuracyhttps://developers.google.com/machine-learning/crash-course/classification/accuracy
precision, recallhttps://en.wikipedia.org/wiki/Precision_and_recall
F1 scorehttps://en.wikipedia.org/wiki/F1_score
Statistics By Jimhttps://statisticsbyjim.com/regression/how-high-r-squared/
Quorahttps://www.quora.com/How-do-I-decide-whether-a-certain-R-square-value-is-good-enough-in-regression-analysis
Remove adshttps://realpython.com/account/join/
https://realpython.com/train-test-split-python-data/#training-validation-and-test-sets
three subsetshttps://en.wikipedia.org/wiki/Training,_validation,_and_test_sets
linear regressionhttps://realpython.com/linear-regression-in-python/
logistic regressionhttps://realpython.com/logistic-regression-python/
neural networkshttps://en.wikipedia.org/wiki/Artificial_neural_network
hyperparameter tuninghttps://en.wikipedia.org/wiki/Hyperparameter_optimization
https://realpython.com/train-test-split-python-data/#underfitting-and-overfitting
underfitting and overfittinghttps://en.wikipedia.org/wiki/Overfitting
Linear Regression in Pythonhttps://realpython.com/linear-regression-in-python/#underfitting-and-overfitting
https://realpython.com/train-test-split-python-data/#prerequisites-for-using-train_test_split
install sklearnhttps://scikit-learn.org/stable/install.html
piphttps://realpython.com/what-is-pip/
Anacondahttps://www.anaconda.com/
fresh environmenthttps://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html
Minicondahttps://docs.conda.io/en/latest/miniconda.html
NumPyhttps://numpy.org/
refresh your NumPy knowledgehttps://realpython.com/tutorials/numpy/
NumPy Tutorial: Your First Steps Into Data Science in Pythonhttps://realpython.com/numpy-tutorial/
https://realpython.com/train-test-split-python-data/#application-of-train_test_split
importhttps://realpython.com/python-import/
Jupyter notebookhttps://realpython.com/jupyter-notebook-introduction/
Python REPLhttps://realpython.com/python-repl/
listhttps://realpython.com/python-list/
NumPy arrayshttps://numpy.org/doc/stable/reference/generated/numpy.ndarray.html
iterablehttps://realpython.com/python-iterators-iterables/
SciPy sparse matriceshttps://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csr_matrix.html
listshttps://realpython.com/python-lists-tuples/
NumPy arrayshttps://realpython.com/numpy-array-programming/
pandas DataFrameshttps://realpython.com/pandas-dataframe/
RandomStatehttps://numpy.org/doc/stable/reference/random/legacy.html?highlight=randomstate#numpy.random.RandomState
Boolean objecthttps://realpython.com/python-boolean/
stratified splithttps://en.wikipedia.org/wiki/Stratified_sampling
arange()https://numpy.org/doc/stable/reference/generated/numpy.arange.html
numerical rangeshttps://realpython.com/how-to-use-numpy-arange/
.reshape()https://realpython.com/numpy-reshape/
randomhttps://realpython.com/python-random/
https://files.realpython.com/media/fig-1.c489adc748c8.png
Remove adshttps://realpython.com/account/join/
https://realpython.com/train-test-split-python-data/#supervised-machine-learning-with-train_test_split
https://realpython.com/train-test-split-python-data/#minimalist-example-of-linear-regression
LinearRegressionhttps://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LinearRegression.html
.fit()https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LinearRegression.html#sklearn.linear_model.LinearRegression.fit
.score()https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LinearRegression.html#sklearn.linear_model.LinearRegression.score
https://files.realpython.com/media/fig-2.850628602c7e.png
estimated regression linehttps://www.britannica.com/science/estimated-regression-equation
https://realpython.com/train-test-split-python-data/#regression-example
California Housing datasethttps://scikit-learn.org/stable/datasets/real_world.html#california-housing-dataset
sklearn.datasets.fetch_california_housing()https://scikit-learn.org/stable/modules/generated/sklearn.datasets.fetch_california_housing.html#sklearn.datasets.fetch_california_housing
tuplehttps://realpython.com/python-tuple/
Gradient boostinghttps://en.wikipedia.org/wiki/Gradient_boosting
GradientBoostingRegressor()https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.GradientBoostingRegressor.html
Random foresthttps://en.wikipedia.org/wiki/Random_forest
RandomForestRegressor()https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestRegressor.html
feature scalinghttps://en.wikipedia.org/wiki/Feature_scaling
Remove adshttps://realpython.com/account/join/
https://realpython.com/train-test-split-python-data/#classification-example
Logistic Regression in Pythonhttps://realpython.com/logistic-regression-python/
handwriting recognitionhttps://realpython.com/logistic-regression-python/#logistic-regression-in-python-handwriting-recognition
https://realpython.com/train-test-split-python-data/#other-validation-functionalities
sklearn.model_selectionhttps://scikit-learn.org/stable/api/sklearn.model_selection.html
Cross-validationhttps://en.wikipedia.org/wiki/Cross-validation_(statistics)
k-fold cross-validationhttps://en.wikipedia.org/wiki/Cross-validation_(statistics)#k-fold_cross-validation
KFoldhttps://scikit-learn.org/stable/modules/generated/sklearn.model_selection.KFold.html
StratifiedKFoldhttps://scikit-learn.org/stable/modules/generated/sklearn.model_selection.StratifiedKFold.html
LeaveOneOuthttps://scikit-learn.org/stable/modules/generated/sklearn.model_selection.LeaveOneOut.html
learning curvehttps://en.wikipedia.org/wiki/Learning_curve_(machine_learning)
learning_curve()https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.learning_curve.html
Hyperparameter tuninghttps://en.wikipedia.org/wiki/Hyperparameter_optimization
GridSearchCVhttps://scikit-learn.org/stable/modules/generated/sklearn.model_selection.GridSearchCV.html
RandomizedSearchCVhttps://scikit-learn.org/stable/modules/generated/sklearn.model_selection.RandomizedSearchCV.html
validation_curve()https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.validation_curve.html
https://realpython.com/train-test-split-python-data/#conclusion
Click here to download the free sample codehttps://realpython.com/bonus/train-test-split-python-data-code/
https://realpython.com/quizzes/train-test-split-python-data/
Split Your Dataset With scikit-learn's train_test_split()https://realpython.com/quizzes/train-test-split-python-data/
https://realpython.com/train-test-split-python-data/#frequently-asked-questions
https://realpython.com/feedback/survey/article/train-test-split-python-data/liked/?from=article-footer
https://realpython.com/feedback/survey/article/train-test-split-python-data/disliked/?from=article-footer
Splitting Datasets With scikit-learn and train_test_split()https://realpython.com/courses/splitting-datasets-scikit-learn-train-test-split/
https://realpython.com/team/mstojiljkovic/
» More about Mirkohttps://realpython.com/team/mstojiljkovic/
https://realpython.com/team/asantos/
Aldrenhttps://realpython.com/team/asantos/
https://realpython.com/team/bweleschuk/
Brendahttps://realpython.com/team/bweleschuk/
https://realpython.com/team/gahjelle/
Geir Arnehttps://realpython.com/team/gahjelle/
https://realpython.com/team/jjablonski/
Joannahttps://realpython.com/team/jjablonski/
https://realpython.com/team/jschmitt/
Jacobhttps://realpython.com/team/jschmitt/
https://realpython.com/team/kstratis/
Kylehttps://realpython.com/team/kstratis/
https://realpython.com/team/mbreuss/
Martinhttps://realpython.com/team/mbreuss/
Level Up Your Python Skills »https://realpython.com/account/join/?utm_source=rp_article_footer&utm_content=train-test-split-python-data
Level Up Your Python Skills »https://realpython.com/account/join/?utm_source=rp_article_footer&utm_content=train-test-split-python-data
https://realpython.com/feedback/survey/article/train-test-split-python-data/liked/?from=article-comments
https://realpython.com/feedback/survey/article/train-test-split-python-data/disliked/?from=article-comments
LinkedInhttps://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Frealpython.com%2Ftrain-test-split-python-data%2F
Twitterhttps://twitter.com/intent/tweet/?text=Interesting%20Python%20article%20on%20%40realpython%3A%20Split%20Your%20Dataset%20With%20scikit-learn%27s%20train_test_split%28%29&url=https%3A%2F%2Frealpython.com%2Ftrain-test-split-python-data%2F
Blueskyhttps://bsky.app/intent/compose?text=Interesting%20Python%20article%20on%20%40realpython.com%3A%20Split%20Your%20Dataset%20With%20scikit-learn%27s%20train_test_split%28%29%20https%3A%2F%2Frealpython.com%2Ftrain-test-split-python-data%2F
Facebookhttps://facebook.com/sharer/sharer.php?u=https%3A%2F%2Frealpython.com%2Ftrain-test-split-python-data%2F
Get tips for asking good questionshttps://realpython.com/python-beginner-tips/#tip-9-ask-good-questions
get answers to common questions in our support portalhttps://support.realpython.com
Real Python Community Chathttps://realpython.com/community/
“Office Hours” Live Q&A Sessionhttps://realpython.com/office-hours/
intermediatehttps://realpython.com/tutorials/intermediate/
data-sciencehttps://realpython.com/tutorials/data-science/
machine-learninghttps://realpython.com/tutorials/machine-learning/
numpyhttps://realpython.com/tutorials/numpy/
Splitting Datasets With scikit-learn and train_test_split()https://realpython.com/courses/splitting-datasets-scikit-learn-train-test-split/?utm_source=realpython&utm_medium=web&utm_campaign=related-course&utm_content=train-test-split-python-data
Linear Regression in Pythonhttps://realpython.com/linear-regression-in-python/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=train-test-split-python-data
Python AI: How to Build a Neural Network & Make Predictionshttps://realpython.com/python-ai-neural-network/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=train-test-split-python-data
Python Web Applications: Deploy Your Script as a Flask Apphttps://realpython.com/python-web-applications/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=train-test-split-python-data
Logistic Regression in Pythonhttps://realpython.com/logistic-regression-python/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=train-test-split-python-data
https://realpython.com/account/signup/?intent=continue_reading&utm_source=rp&utm_medium=web&utm_campaign=rwn&utm_content=v1&next=%2Ftrain-test-split-python-data%2F
Continue »https://realpython.com/account/signup/?intent=continue_reading&utm_source=rp&utm_medium=web&utm_campaign=rwn&utm_content=v1&next=%2Ftrain-test-split-python-data%2F
Sign-Inhttps://realpython.com/account/login/?next=/train-test-split-python-data/
Start Herehttps://realpython.com/start-here/
Learning Resourceshttps://realpython.com/search
Code Mentorhttps://realpython.com/mentor/
Python Referencehttps://realpython.com/ref/
Python Cheat Sheethttps://realpython.com/cheatsheets/python/
Support Centerhttps://support.realpython.com/
Learning Pathshttps://realpython.com/learning-paths/
Quizzes & Exerciseshttps://realpython.com/quizzes/
Browse Topicshttps://realpython.com/tutorials/all/
Live Courseshttps://realpython.com/live/
Bookshttps://realpython.com/books/
Podcasthttps://realpython.com/podcasts/rpp/
Newsletterhttps://realpython.com/newsletter/
Community Chathttps://realpython.com/community/
Office Hourshttps://realpython.com/office-hours/
Learner Storieshttps://realpython.com/learner-stories/
Plans & Pricinghttps://realpython.com/account/join/
Team Planshttps://realpython.com/account/join-team/
For Businesshttps://realpython.com/account/join-team/inquiry/
For Schoolshttps://realpython.com/account/join-team/education-inquiry/
Reviewshttps://realpython.com/learner-stories/
About Ushttps://realpython.com/about/
Teamhttps://realpython.com/team/
Mission & Valueshttps://realpython.com/mission/
Editorial Guidelineshttps://realpython.com/editorial-guidelines/
Sponsorshipshttps://realpython.com/sponsorships/
Careershttps://realpython.workable.com
Press Kithttps://realpython.com/media-kit/
Merchhttps://realpython.com/merch
https://www.youtube.com/realpython
https://x.com/realpython
https://www.linkedin.com/company/realpython-com
https://www.facebook.com/LearnRealPython
https://github.com/realpython/
Privacy Policyhttps://realpython.com/privacy-policy/
Terms of Usehttps://realpython.com/terms/
Securityhttps://realpython.com/security/
Contacthttps://realpython.com/contact/
https://realpython.com/

Viewport: width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover

Robots: max-image-preview:large


URLs of crawlers that visited me.