Исходный столбец Datetime:
Код: Выделить всё
import polars as pl
df = pl.from_repr("""
┌─────────────────────┐
│ Index │
│ --- │
│ datetime[ns] │
╞═════════════════════╡
│ 2017-01-01 00:00:00 │
│ 2017-01-01 01:00:00 │
│ 2017-01-01 02:00:00 │
│ 2017-01-01 03:00:00 │
│ 2019-12-31 20:00:00 │
│ 2019-12-31 21:00:00 │
│ 2019-12-31 22:00:00 │
│ 2019-12-31 23:00:00 │
└─────────────────────┘
""")
Код: Выделить всё
┌─────────────────────┐
│ Index │
│ --- │
│ datetime[ns] │
╞═════════════════════╡
│ 2022-01-01 00:00:00 │
│ 2022-01-01 01:00:00 │
│ 2022-01-01 02:00:00 │
│ 2022-01-01 03:00:00 │
│ 2022-12-31 20:00:00 │
│ 2022-12-31 21:00:00 │
│ 2022-12-31 22:00:00 │
│ 2022-12-31 23:00:00 │
└─────────────────────┘
Подробнее здесь: https://stackoverflow.com/questions/755 ... ime-column
Мобильная версия