One-hot encoding replaces a categorical variable with as many binary columns as there are categories, with only one equal to 1 per row. It suits categories with no order. With many levels it creates many columns, and handle_unknown='ignore' avoids an error on a category absent from training.
Example
OneHotEncoder(handle_unknown='ignore')