i want to VIF analysis on a dataset df. Here, X is the subsetset of df with only the independant variables. this is my code:
from statsmodels.stats.outliers_influence import variance_inflation_factor
vif=pd.DataFrame()
vif["feature"]=X.columns
vif["value"]=[variance_inflation_factor(X.values,i) for i in range(len(X.columns))]
it is showing an error message: TypeError: ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe'
entire error message: https://pastebin.com/Bn103xjP
i searched the web but could not find a similar error. I expected it to run smoothly because i wrote this code exactly as it is from a book.