Right now I'm working with a file containing scraped numbers, but whenever I try to do some calculations with them a ValueError (invalid literal for int() with base 10: '6,92') pops up.
The piece of code I use to get the numbers from the web looks like this:
numberX = driver.find_element_by_xpath('//*[@id="form1"]/div[3]/div/div/div[1]/div[2]/div/div/div[3]/span/i').text
number = ''
for i in numberX:
if i in '0123456789,':
number += i
'numberX' contains alphanumerical values, but 'number' does not. Still, the dtype of 'number' is object.
I have tried:
df['number'].astype(str).astype(int)
But the same ValueError pops up.
If I export the data to Excel, the column with the 'number' values appears in text format, and Excel gives me the possibility to convert them to numbers. Also, I have checked and the values only contain numbers and a commas (',').
A piece of the printed dataframe looks something like this:
Date Amount Number
0 11/04/2020 10000 6,92
1 11/04/2020 10000 6,77
2 11/04/2020 10000 6,66
3 11/04/2020 10000 6,59
Any idea of what could be happening?
Thanks in advance!