Pandas & Data Analysis·Practice drills 4

Drill 10: Write a test — Dates and times

Write one test you would add for this example.

Beginner 5 min read Lesson 108 of 300 Challenge included
What you will be able to do
  • Write one test you would add for this example.

Practice task

Write one test you would add for this example.

dates.pyPython
import pandas as pd

df = pd.DataFrame({
    'created_at': pd.to_datetime(['2026-10-01', '2026-10-02', '2026-11-01']),
    'minutes': [10, 20, 15],
})

df = df.set_index('created_at')
print(df.resample('ME')['minutes'].sum())
print(df.index.month)
Your turn

Write your answer

Easy

Write one test you would add for this example.

TEXT · starter
Your answer…
Study tools

Make it yours.

Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.

Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign in
Finished reading?

Lock in what you just learned.

Mark this lesson complete to save your place and move one step closer to the certificate.

Lesson 108 of 300 · 0% of course