Backport PR #38532 on branch 1.2.x (BUG: Regression in logical ops raising ValueError with Categorical columns with unused categories)
Backport PR #38532: BUG: Regression in logical ops raising ValueError with Categorical columns with unused categories