More datasets can be found at the UCI website

  • Practice loading CSV files into Python using the CSV.reader() function in the standard library
  • Practice loading CSV files using NumPy and the numpy.loadtxt() function
  • Practice loading CSV files using Pandas and the pandas.read_csv() function

In [84]:
# Load CSV using Pandas from URL
import pandas

url = "https://archive.ics.uci.edu/ml/machine-learning-databases/pima-indians-diabetes/pima-indians-diabetes.data"
names = ['preg', 'plas', 'pres', 'skin', 'test', 'mass', 'pedi', 'age', 'class']

data = pandas.read_csv(url, names=names)

print(data.shape)


(768, 9)

In [83]:
# Load the data into a numpy array
import numpy as np
import requests

url = "https://archive.ics.uci.edu/ml/machine-learning-databases/pima-indians-diabetes/pima-indians-diabetes.data"
file = requests.get(url)
    
data = np.loadtxt(file.iter_lines(), delimiter=',')

print(data.shape)


(768, 9)