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

Parsing datetime strings

You're a London transport analyst tasked with understanding summertime bike-sharing demand patterns. The dataset contains hourly rental data from July, but the time column is stored as strings in "MM-DD-YYYY HH:MM" format. To analyze when demand peaks, you first need to convert it to a proper Datetime dtype.

polars is loaded as pl. The DataFrame bikes is available with columns time, rentals, and temp.

Bu egzersiz, kursun bir parçasıdır

Data Transformation with Polars

Kursa Göz Atın

Egzersiz talimatları

  • Parse the time column to a Datetime dtype using the format "%m-%d-%Y %H:%M".

Uygulamalı etkileşimli egzersiz

Bu egzersizi bu örnek kodu tamamlayarak deneyin.

# Parse the time column to Datetime
bikes.with_columns(
    pl.col("time").____.____(pl.____, "%m-%d-%Y %H:%M")
)
Kodu Düzenle ve Çalıştır