s = df[column_to_encode].explode() columns_list = list(df.columns) columns_list.remove(column_to_encode) df[column_list].join(pd.crosstab(s.index, s))