Last answered:

06 Jul 2023

Posted on:

03 Jul 2023

0

Resolved: 2:52 - Error in the indexing

As I was replicating the code above in jupyter, I did not get the message of error with series_b[0]. It gave me the first number as if I had not established an explicit index beforehand. Here's the print screen. Thanks for your help.

 

4 answers ( 1 marked as helpful)
Posted on:

03 Jul 2023

0

sorry, wrong screenshot above. Here it is:

Instructor
Posted on:

05 Jul 2023

0

Hi Vania!

Thanks for reaching out!

In this case, calling series_b[0] should result in a KeyError because there is no element in the Series with an index of 0.

Please check earlier in your code if you created another Series object with an identical name.

Furthermore, you can try to restart Kernel and re-run only this part of the code (after importing pandas) and see if you still don't obtain an error message after executing series_b[0].

Best,

Ivan

Posted on:

05 Jul 2023

0

Hi Ivan,

The second option you suggested worked. Thanks for your help!

Best, Vânia

Instructor
Posted on:

06 Jul 2023

0

You are very welcome!
Best,
Ivan

Submit an answer