convert column string to int pandas
df['DataFrame Column'] = df['DataFrame Column'].astype(int)
convert column string to int pandas
df['DataFrame Column'] = df['DataFrame Column'].astype(int)
python string to decimal
import decimal
list = ["3","4.5","6"]
string = "6"
list2 = []
control = Decimal(7)
for i in list:
list2.append(Decimal(i))
decimal_string = Decimal(string)
#Control is to show that a decimal number has a class of <class 'decimal.Decimal'>
print(type(control))
#<class 'decimal.Decimal'>
print(type(decimal_string))
for i in list2:
print(i)
print(type(i))
#<class 'decimal.Decimal'>
#As shown above, converting strings and arrays to a decimal is quite easy.
#I hope this helps you to solve your problem :)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us