Collapse/group columns in pandas: `df.groupby(list_of_columns)`

I need help in writing a code that will group the columns and convert the data as mentioned above.

I have data with 3000 columns, each containing a value of 0 or 1. I need to group these columns into weeks, with the columns from 1-7 in week 1, 8-14 in week 2, and so on. If any of the columns in a given week have a value of 1, then the week should be given a value of 1, otherwise it should be given a value of 0.

I need help writing a code to accomplish this.

Input Data

|  days  |  1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  |  9  | 10  |
|--------|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|
| value  |  0  |  0  |  0  |  0  |  1  |  0  |  0  |  0  |  0  |  0  |

Output Data

| weeks | week_1 | week_2 |
|-------|--------|--------|
| value |   0    |   1    |
import pandas as pd

# Read input data
data = pd.read_csv("input_data.csv")

# Create a dictionary to store the week number as key and column range as value
week_dict = {}
for i in range(1, 301, 7):
    week_dict[i//7 + 1] = range(i, i+7)

# Create a new dataframe to store the output data
output_data = pd.DataFrame(columns=['weeks'])

# Iterate through the week_dict and create a new column for each week
for week, columns in week_dict.items():
    week_data = data.iloc[:, columns].any(axis=1).astype(int)
    output_data[f'week_{week}'] = week_data

# Print the output data
print(output_data)