I was trying to assign Y axis to my DataSet:
Y = dataset.iloc[:, 17].values
When tried this command I was getting the following error:
single positional indexer is out-of-bounds
The DataFrame.iloc
works based on the integer positioning so you have to provide values not more than the number of rows and columns in your DataFrame
or dataset. In your case, the dataset.iloc[:,17]
will fetch all the rows and the first 17 columns providing a matrix of rows*17
size. If you want only the columns then use dataset.iloc[:17]
and this will fetch the first 17 columns. Make sure your dataset has 17 or more columns or it will show Out-of-bounds
error.
For details refer this answer. pandas iloc vs ix vs loc explanation?