Computer Science, asked by priyankajkp, 11 hours ago

any computer expert here please help me with this what is the purpose of the following statement 1.df[:] 2.df.iloc[:-4,:]
please don't spoil if you don't know the ans
otherwise I will report all your answers

it is correct question only computer students can understand it.​

Answers

Answered by Anonymous
4

Answer:

Very simply put,

For the same training data frame df, when I use X = df.iloc[:, :-1].values, it will select till the second last column of the data frame instead of the last column (which is what I want BUT it's a strange behavior I've never seen before), and I know this as the second last column's value and the last column's value for that row is different.

However, using y = df.iloc[:, -1].values gives me the row vector of the last column's values which is exactly what I want.

Why is the negative 1 for X giving me the second last column's value instead?

Explanation:

hope it will be helpful to you dear friend

Similar questions