Last answered:

29 Apr 2022

Posted on:

14 Apr 2022

1

Resolved: Casting string data to integer

hi !
I have some doubts.
I think earlier it was said that -
We can't directly cast strings to integers.
We can go through floats (string-> float -> integer).
but here in the video , the data is directly converted to integers.

Why I'm getting the value error ?
please check the screenshot of jupyter notebook attached below

image.png

1 answers ( 1 marked as helpful)
Posted on:

29 Apr 2022

1

In your string array there is 'Sep' which cannot be converted to an integer, and also I think they meant that we can't always cast strings into integers, we only can cast them into integers when we are sure that we don"t have any non-numeric character in he string.

Submit an answer