Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

convert price to float python

from re import sub
from decimal import Decimal

money = '$6,150,593.22'
value = Decimal(sub(r'[^d.]', '', money))
Comment

convert decimal to float in python

# Method 1:
float_number = float (decimal_number)

# Method 2:
float_number = decimal_number * 1.0
Comment

PREVIOUS NEXT
Code Example
Python :: # time delay in python script 
Python :: how to store in parquet format using pandas 
Python :: seaborn bar plot 
Python :: python pop element 
Python :: rotate 90 degrees clockwise counter python 
Python :: list python virtual environments 
Python :: check if path exists python 
Python :: python create sqlite db in memory 
Python :: load img cv2 
Python :: __str__() 
Python :: creating data frame in python with for loop 
Python :: read files and write into another files python 
Python :: python talib install windows 
Python :: how to calculate the sum of a list in python 
Python :: dataframe delete duplicate rows with same column value 
Python :: create a generator from a list 
Python :: dropna in specific column pandas 
Python :: append vs insert python 
Python :: get mode dataframe 
Python :: LoginRequiredMixin 
Python :: from math import python 
Python :: how to install neat 
Python :: day name in python 
Python :: make a script run itself again python 
Python :: python remove duplicate numbers 
Python :: tkinter get child in frame 
Python :: how to convert utf-16 file to utf-8 in python 
Python :: how to sort a list of dictionary by value in descending order? 
Python :: python list divide 
Python :: user input of int type in python 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =