Load Raw_Data using NumPy

The source code is for load the data from .csv file. However you need a NumPy. NumPy is the fundamental package for array computing with Python. The answer for source code is (768, 9).

import csv
import numpy
filename = 'pima-indians-diabetes.data.csv'
Raw_Data = open(filename, 'r')
reader = csv.reader(Raw_Data, delimiter=',', quoting=csv.QUOTE_NONE)
x = list(reader)
dataset = numpy.array(x).astype('float')
print(dataset.shape)

The details about the Pima Dataset can be found here >> https://www.kaggle.com/uciml/pima-indians-diabetes-database

or we can load the data form URL

# Load CSV from URL using NumPy
from numpy import loadtxt
import urllib.request
raw_data = urllib.request.urlopen('https://bit.ly/2GX9wC5')
dataset = loadtxt(raw_data, delimiter=",")
print(dataset.shape)