// For categorical effects, one variance term per predictor level
if categorical:
split_data = {}
groups = list(set([re.sub(r"^.*?\:", "", c) for c in cols]))
for g in groups:
patt = re.escape(r":%s" % g) + "$"
level_data = data.filter(regex=patt)
After Change
split_data[g] = level_data//.values
data = split_data
else:
data.columns = [c.split(":")[0] for c in cols]
else:
data = X