In my dataset, i have a feature (called Size) like this one:
import pandas as pd
dit={"Size" : ["0","0","5","15","10"] }
dt = pd.DataFrame(data=dit)
when i run dt.info()
it gives me the below result:
Size 140 non-null object
However, i expect it to be int
. When i try the below code:
dt.loc[:,"Size"] = dt.loc[:,"Size"].astype(int)
it complains with:
ValueError: invalid literal for int() with base 10: ' '
How can i convert Size
to int
?