python iterate over a groupby dataframe code example Example: df groupby loop grouped = df.groupby('A') for name, group in grouped: ...