Premium problem156. Split a Timestamp into Features

Easy Locked

events has columns event_id and timestamp (datetime).

Add the columns year, month, day, weekday and hour, all integers, with weekday as pandas gives it (Monday 0 through Sunday 6). Return the original columns plus the five new ones, index unchanged.

Input

   event_id           timestamp
0         1 2022-03-07 14:30:00
1         2 2021-12-25 00:05:00

Output

   event_id           timestamp  year  month  day  weekday  hour
0         1 2022-03-07 14:30:00  2022      3    7        0    14
1         2 2021-12-25 00:05:00  2021     12   25        5     0

Premium problem

This one's part of Premium. Unlock the full Pandas track plus every other premium problem on the site.

Implement solve(...)