I have the following code:
for i in range(0, len(terceros_df.NIT)):
print 'esto es i =', i
number = terceros_df.iloc[i]['NIT']
length = len(str(number))
if length == 10:
str_number = str(number)
nit = str_number[:-1]
dv = str_number[-1:]
nit = format(int(nit), ',d').replace(',', ".")+ "-" + str(dv)
terceros_df.loc[i,'NIT'] = nit
print nit
else:
number = format(int(number), ',d').replace(',', ".")
terceros_df.loc[i,'NIT'] = number
print number
print 'La cantidad de caracteres son:',length
print '-----------------------'
The error is:
<type 'exceptions.ValueError'>: invalid literal for int() with base 10: '19065171.
According to my understanding, you are trying to read a float, but I am passing an integer, in summary as a result we want an integer not a float. How to solve?