def f1(x):
    return pd.Series(1, set(x))

def f2(x):
    return pd.value_counts(x)
print(df.set_index('ID').col2.apply(f1).fillna(0).astype(int).reset_index())
print('')
Create dummies for non-unique lists into column in Python