Drills tagged with this skill, unpassed first. Pass them all to mark the skill ready for scenarios.
date column was read from CSV as plain text. Date math and .dt operations only work once it's a real datetime type.
Your task. Write to_datetime_column(df) that returns the date column converted to a pandas datetime Series.
Example. the text "2021-03-15" becomes a real datetime value.
Notes. Return the converted Series. Every value is a valid YYYY-MM-DD date string.extract_months(df) that parses the date column and returns a Series of month numbers (1-12).
Example. "2021-03-15" → 3, "2021-12-01" → 12.
Notes. Return a Series of integers. Parse the text to datetime first, then reach for the month.rows_in_year(df, year) that returns the rows of df whose date falls in the given year. Keep the date column exactly as it came in.
Example. year=2021 keeps only rows dated in 2021, in their original order.
Notes. Parse the dates to compare years, but don't change the returned date values. No matching rows → empty DataFrame.