sklearn.datasets package has several functions to load or generate datasets for test machine learning algorithms. Some simple functions have been demonstrated here.
More details: http://scikit-learn.org/stable/datasets/index.html
The downloadable jupyter notebook has been provided below. The notebook can be downloaded by clicking on the “view raw” text at the end of the notebook.