Last answered:

20 May 2024

Posted on:

16 Mar 2024

2

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.

1 answers ( 0 marked as helpful)
Posted on:

20 May 2024

1

Thank you so much F Dixon, I had the same issue and your solution was advantageous!

Submit an answer