I am new to pandas in Jupyter and have inherited some very strange code. I have a data frame object with arbitrarily named columns most of which contain integers. In one of the cells there is
df = df/100
This seemingly divides every entry in the data frame by 100. Unfortunately some entries can be strings and this causes an error since you can't divide by 100. Does anyone know of a way to catch such an exception and to move on. I would like if the cell is an integer/double/float for the division to occur and if it is a string to do nothing. I was thinking of something like
for (lambda x in df.columns):
if x.type != "str":
df[x] = df[x]/100
I probably need to add a loop for the rows and use df.iloc or something, but really I am not sure the best way to do this but I am sure there is some cute way of accessing this information.