Sorry, I've seen many question related with this error but even with all this information I can't solve it.
I have a dataframe df with a column named int_rate. The column's type is O. It keeps the percentages, so each line is like: 10.95 % I need to remove the % sign to transform then the column in int. I've tried with the following code:
df['int_rate']=df['int_rate'].apply(lambda x: x[:-1])
I get the following error:
TypeError: 'float' object is not subscriptable.
The first thing I don't understand is why float object if my column type is not float, and if so, how can I get rid of % sign?
10.95%that is set withpd.options.display.float_formatBUT your data is actually a float.