of Python, to list serise value from the string float I was about to change it to error
.What's wrong?
The code intention is change_csv['Volume'] serise is 1.61M, 77.2K, and it's kilo and millon I want to make this 103,106 and calculate it, but I want to convert it into float by extracting only the string type.
3,to 6 python float error string
I think you should check if element[:][:-1]
really comes out in the form of "1.61M"
. Assuming so, turning the fixed code will produce a normal output.
str = "1.61558M"
num = float(str[:-1])
if str[-1:] == 'M' :
num *= 1000000
print(int(num)) // 1615580
571 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
609 GDB gets version error when attempting to debug with the Presense SDK (IDE)
578 Understanding How to Configure Google API Key
910 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.