How to make the variable "X" I can assign specific columns, as I did with the variable "Y". When trying to do this for some reason, it gives a list of rows 1 through n and not the data of the columns.
import pandas as pd pd.options.mode.chained_assignment = None names = ['sepal length','sepal width','petal length','petal width','class'] dataframe = pd.read_csv("https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data", names = names) from sklearn.cross_validation import train_test_split dataframe['class'].replace("Iris-setosa",1,inplace= True) dataframe['class'].replace("Iris-virginica",2,inplace = True) dataframe['class'].replace("Iris-versicolor",3,inplace=True) X = dataframe[1:3] Y = dataframe["class"] X.head() Out[90]: sepal length sepal width petal length petal width class 1 4.9 3.0 1.4 0.2 1 2 4.7 3.2 1.3 0.2 1