Session Ready
Exercise

Dummy trap

A dummy trap is a situation where different dummy variables convey the same information. In this case, if an employee is, say, from the accounting department (i.e. value in the accounting column is 1), then you're certain that s/he is not from any other department (values everywhere else are 0). Thus, you could actually learn about his/her department by looking at all the other departments.

For that reason, whenever \(n\) dummies are created (in your case, 10), only \(n\) - 1 (in your case, 9) of them are enough, and the \(n\)-th column's information is already included.

Therefore, you will get rid of the old department column, drop one of the department dummies to avoid dummy trap, and then the two DataFrames.

Instructions
100 XP
  • .drop() the accounting column to avoid "dummy trap".
  • .drop() the old column department as you do not need it anymore.
  • Join the new departments DataFrame to the employee dataset (this has been done for you).