AnalystPath

Resample Daily Metrics to Monthly

PandasMediumMid levelSnowflake~15 min

Problem

**[Asked at Snowflake]**

Aggregate daily values into monthly totals using pandas resampling.

Return columns: `month` (YYYY-MM), `total`. Order by month.

Input data

Example rows — the live problem includes the full dataset.

metrics
datevalue
2023-01-05100
2023-01-15150
2023-01-25200
2023-02-0350
2023-02-1875

Expected output

Your answer should return 3 rows with the columns month, total.

Starter code (Pandas (Python))

import pandas as pd

def resample_monthly(metrics: pd.DataFrame) -> pd.DataFrame:
    # Your code here
    return metrics

Solve this Pandas question free

Write Pandas (Python) and run it instantly in your browser — even on your phone. No signup needed to try.

Solution & explanation

Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.

Sign up free to unlock

Related Pandas questions