Trying to impute missing categorical data

I believe this is a bug related to how the interpolated values are re-combined with the observed values, and opened an issue here.

In the meantime, you can work around this using at.cast to manually convert the datatype of idx, as in:

data = np.ma.masked_equal([1, 1, 0, 0, 2, -1, -1], -1)
with pm.Model():
    idx = pm.Categorical(f"{var}_idx", p=[0.1, 0.2, 0.7], observed=data)
    idx = at.cast(idx, 'int64')