Answers for "how to add another timestamp column plus two hours"

0

how to add another timestamp column plus two hours

from datetime import timedelta
    two_hours = pd.Timedelta(hours=2)
    df["dummy_date"] = df["Date_Time"] + two_hours
    df

    Date_Time               Date    Duration    value   Remark      dummy_date
0   2018-08-14 02:00:00     2018-08-14    3     4     e         2018-08-14 04:00:00
1   2018-08-14 01:00:00     2018-08-14    0     3     o         2018-08-14 03:00:00
2   2018-08-14 00:00:00     2018-08-14    0     2     k         2018-08-14 02:00:00
3   2018-08-13 23:00:00     2018-08-13    10    1     x         2018-08-14 01:00:00
4   2018-08-13 22:00:00     2018-08-13    2     0     c         2018-08-14 00:00:00
5   2018-08-13 21:00:00     2018-08-13    20    23    z         2018-08-13 23:00:00
6   2018-08-13 20:00:00     2018-08-13    1     22    a         2018-08-13 22:00:00
Posted by: Guest on August-30-2021

Code answers related to "how to add another timestamp column plus two hours"

Python Answers by Framework

Browse Popular Code Answers by Language