import pandas as pd

# Read CSV file into DataFrame
df = pd.read_csv("commute_activity_data.csv")

# Filter to only male respondents
male_df = df[df["gender"] == 1]

# Define age groups
age_groups = [(20, 30), (30, 40), (40, 50)]

results = {}

for min_age, max_age in age_groups:
    age_group_df = male_df[(male_df["age"] >= min_age) & (male_df["age"] < max_age)]
    avg_walk_time = age_group_df["walk_time"].mean()
    results[f"{min_age}-{max_age}"] = round(avg_walk_time, 1)

print(results)
