I have a dataset of (1460, 76)
size. It's currently in pandas Dataframe, It has all sorts of datatypes: int, float, object
. I'm trying to run VIF
function on this dataframe to get correlation in my variables but, it's throwing this error:
TypeError: '>=' not supported between instances of 'str' and 'int'
VIF Code:
vif = [variance_inflation_factor(df.values, i) for i in range(df.shape[1])]
print(vif)
What could be the reason, is it because I have strings in my data?
Sounds like some of your data is stored as strings instead of numeric data types. Try using pandas.to_numeric on your data frame.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.