I have a column in a table that has % values like this:
0 87%
1 87%
2 84%
3 96%
4 97%
its dtype: object
I want to change these values and its dtype (which is object) to integers or float so that for example (87% becomes 87 and etc.) Is there a way to change it? Maybe using pd.to_numeric?
I tried pd.to_numeric(movies['Rotten Tomatoes'].str.rstrip("%")) and it did work and all but it didn't change the dtype from object to float or integer when using its values.
source https://stackoverflow.com/questions/74416613/how-do-i-convert-a-percentage-object-to-float-or-integer
Comments
Post a Comment