grouped = df.groupby('group')
for group_name, group in grouped:
print('
CREATE TABLE {}('.format(group_name))
print(group["column"])
grouped = df.groupby('A')
for name, group in grouped:
...
df = df.groupby('l_customer_id_i').agg(lambda x: ','.join(x))
for name in df.index:
print name
print df.loc[name]