Posted on:

16 Mar 2024

0

Exercise solution won't run in new versions of pandas - solution

The line in the exercise solution:
data_with_dummies = pd.get_dummies(data_no_multicollinearity, drop_first=True)


now creates True/False dummies by default. When the VIF is applied it causes an error because of the dummy type. One solution to fix this is initially supplying the old default datatype:
data_with_dummies = pd.get_dummies(data_no_multicollinearity, drop_first=True, dtype=np.uint8). This or another solution should be applied in the code or a note made.

0 answers ( 0 marked as helpful)

Submit an answer