The problem is that your data columns aren’t a numeric type, and numpy.log()
expects numeric data. You can convert the data to numeric values using pandas.to_numeric()
mdata = df1[cols].apply(pd.to_numeric)
or by converting the columns to a specific numeric type by using DataFrame.astype()
mdata = df1[cols].astype(float)
CLICK HERE to find out more related problems solutions.