0
Python, using .txt file to create a new chart.
Hi guys :) I wanted to create a chart that will use the data from my .txt file (spectral analysis) but there is an error that I don't know how to delete. 'ValueError: invalid literal for int() with base [number of the code line]: 'd>>ż43' In my .txt the first line of the value x is 43,066406. I don't know how to deal with this. I've just wanted to create a chart that x can be frequency and y can be dB. Please, help me.
4 Respostas
+ 3
The error clearly says 'invalid literal for int() with base 10 ' and its bcz of that comma in "43,065406".
>> int('1234')
Will result in 1234
But
>> int('1,234')
It will give you a ValueError coz string can only be converted into int type if it consists of only numeric characters.
+ 2
No need to convert those into whole numbers. Just use '.' for decimal instead of comma and use float() instead of int() and you're good to go.
+ 1
Thank you :)
0
So if I want to get this chart I must change all the numbers into whole numbers?
But is there another way to get more accurate chart?