LoslegenKostenlos loslegen

Finding ambiguous datetimes

At the end of lesson 2, we saw something anomalous in our bike trip duration data. Let's see if we can identify what the problem might be.

The data is loaded as onebike_datetimes, and tz has already been imported from dateutil.

Diese Übung ist Teil des Kurses

Working with Dates and Times in Python

Kurs anzeigen

Anleitung zur Übung

  • Loop over the trips in onebike_datetimes:
    • Print any rides whose start is ambiguous.
    • Print any rides whose end is ambiguous.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Loop over trips
for trip in onebike_datetimes:
  # Rides with ambiguous start
  if tz.____(____):
    print("Ambiguous start at " + str(trip['start']))
  # Rides with ambiguous end
  if tz.____(____):
    print("Ambiguous end at " + str(trip['end']))
Code bearbeiten und ausführen