pandas iterate over groups code example
Example 1: loop through groupby pandas
grouped = df.groupby('group')
for group_name, group in grouped:
print('\nCREATE TABLE {}('.format(group_name))
print(group["column"])
Example 2: df groupby loop
grouped = df.groupby('A')
for name, group in grouped:
...