Lets say I am working with a dataset which has 10 columns. Now, the Label column for my 'Y' is 1. How do I set my X and Y. This is what I have done so far.
array = dataframe. values
X = array[:,0:2:32] #I know this isn't the right way to do this.
Y = array[:,1]
Yes, we can assign names to columns and omit the column with name=label, but I am trying to find a straight forward approach based on indexes. Any leads?
You can do this:
Y = df.loc[:,1].values
cols = list(df.loc[:,:0]) + list(df.loc[:,2:32])
X = df[cols].values