Skip to content
Advertisement

how to fix python pandas encoding issue?

I import csv table into JUPYTER NOTEBOOK, and something wrong is happening when I try to iloc a video views column (К-ть переглядів).

I need to format this cell to INT type (using .astype()), but it tells me that there is an error:

ValueError: invalid literal for int() with base 10: ‘380xa0891xa0555’

Can anyone please tell me what is wrong?

Screenshot: enter image description here

Advertisement

Answer

This is a non breaking space (chr(160)). Use str.replace to remove them.

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement