Last answered:

01 Dec 2022

Posted on:

30 Nov 2022

0

IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

hello i got this error while trying to load this particular code in the loan-dat.csv while trying to work on all rows on the  'term' column

header_strings[:,2]
i got this after trying to run the code above.

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
Input In [85], in <cell line: 1>()
----> 1 header_strings[:,2]

IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
1 answers ( 0 marked as helpful)
Instructor
Posted on:

01 Dec 2022

0

Hey Opeyemi,

Thank you for reaching out!

The problem seems to be stemming from the fact that you are treating the 1-dimensional header_strings array as a 2-dimensional object.

Could you please let us know which course, lecture, and exercise you are referring to?

Kind regards,
365 Hristina

Submit an answer