Aan de slagGa gratis aan de slag

Filtering for a specific datetime

Continuing with the London bike-sharing data, your manager wants to know the exact demand at a specific moment. Find the rental count at noon on the first day of the dataset to see how busy the lunch hour was.

polars is loaded as pl. The DataFrame bikes is available with the time column as a Datetime. The dataset starts on July 1st, 2016.

Deze oefening maakt deel uit van de cursus

Data Transformation with Polars

Cursus bekijken

Oefeninstructies

  • Filter bikes to find the row where time equals noon on July 1st, 2016.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Filter for noon on July 1st, 2016
bikes.filter(
    pl.col("time") == pl.____(year=____, month=____, day=____, hour=____)
)
Code bewerken en uitvoeren