Extract Year and Month
Parse dates with Pandas. Each input is a valid date string in YYYY-MM-DD format, with no time or timezone. Return a list of dictionaries containing integer year and month for each date in original order. Retain duplicates. Empty input returns an empty list.
Difficulty: beginner
Show hint
Convert an object Series using pd.to_datetime with format="%Y-%m-%d". Use the .dt.year and .dt.month accessors to build an output DataFrame, then convert it to records.
Examples
[["2026-10-18","2025-01-02"]][{"year":2026,"month":10},{"year":2025,"month":1}]