Skip to content

Instantly share code, notes, and snippets.

@grohith327
Last active June 9, 2018 14:52
Show Gist options
  • Save grohith327/55fd3919e277de3d75b8f82cf0c9b0ae to your computer and use it in GitHub Desktop.
Save grohith327/55fd3919e277de3d75b8f82cf0c9b0ae to your computer and use it in GitHub Desktop.
import pandas as pd
import numpy as np
from sklearn.utils import shuffle
## Load Iris dataset
df = pd.read_csv('/Users/rohith/Documents/Datasets/Iris_dataset/iris.csv')
## Store the target vaue
classes = df['Species']
## Drop the Id and Class values from dat
df = df.drop(['Id','Species'],axis=1)
## Convert dataframe into list and then into a numpy array
data = df.values.tolist()
data = np.array(data)
## Shuffle classes and data
data,classes = shuffle(data,classes)
## First 135 points are used for training and the rest is used for testing
train_data = data[:135]
test_data = data[135:]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment