Python Quest

Track 14 · Lesson 10 of 12

Dates in pandas

Turn date text into real datetimes, extract parts with the dt accessor, measure durations, and resample a time series by week or month.

About 45 minAdvanced3 exercises

You will be able to

  • Convert text to datetimes with pd.to_datetime or parse_dates, coercing bad values to NaT
  • Extract year, month, weekday and other parts with the dt accessor
  • Subtract dates to get durations and read them in days
  • Resample a time series to monthly or weekly totals and smooth it with a rolling mean

Included with a Formula Quest membership

It has 3 graded exercises with feedback, hints and solutions. Python Quest is included in Formula Quest memberships that cover Python; membership and billing are managed on Formula Quest.

View Formula Quest memberships

Tracks 1 and 2, the first lesson of every track, the playground and the dataset library are free.