Last answered:

10 Oct 2022

Posted on:

01 Jul 2022


Don't understand the np.delete; what values does it delete?

I don't understand what this code is deleting:

np.delete(lending.co_data_numeric, 0).shape

Is it deleting the first column? However, the shape indicates that there is only one column left. The instructor didn't make it clear when going through this. Thanks!

1 answers ( 0 marked as helpful)
Posted on:

10 Oct 2022


Actually it deletes one value not one column
Passing one value to np.delete without specifying an axis will flatten the array and then deletes the first value out of it
That is why shape indicates there is only one column

Submit an answer