I have a problem with grouping and adding columns based on conditions in a pandas DataFrame. Here is my code:
# ==============================================