BaşlayınÜcretsiz Başlayın

Making timedelta columns

Earlier in this course, you wrote a loop to subtract datetime objects and determine how long our sample bike had been out of the docks. Now you'll do the same thing with Pandas.

rides has already been loaded for you.

Bu egzersiz

Working with Dates and Times in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Subtract the Start date column from the End date column to get a Series of timedeltas; assign the result to ride_durations.
  • Convert ride_durations into seconds and assign the result to the 'Duration' column of rides.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Subtract the start date from the end date
ride_durations = ____ - ____

# Convert the results to seconds
____[____] = ride_durations.____

print(rides['Duration'].head())
Kodu Düzenle ve Çalıştır