I am trying to calculate the time period in seconds that cars were not available. I have the following table:
╔═════════════════════╦═══════════╦══════╦═════════════╗
║ statusDateTime ║ shift ║ car ║ isAvaliable ║
║ 2019-04-02 02:58:39 ║ 190402001 ║ E077 ║ 1 ║
║ 2019-04-02 13:17:58 ║ 190402002 ║ E077 ║ 0 ║
║ 2019-04-02 13:35:10 ║ 190402002 ║ E077 ║ 1 ║
╚═════════════════════╩═══════════╩══════╩═════════════╝
To solving this I want to divide the last binary column (isAvaliable) into isAvaliable_0 and isAvaliable_1 where I will write the time from the statusDateTime column. As a result there is should be the following table:
╔═══════════╦══════╦═════════════════════╦═════════════════════╗
║ Shift ║ Car ║ isAvaliable_00 ║ isAvaliable_01 ║
║ 190402001 ║ E077 ║ 2019-04-02 02:58:39 ║ 2019-04-02 13:17:58 ║
║ 190402002 ║ E077 ║ 2019-04-02 13:35:10 ║ 2019-04-02 14:35:10 ║
╚═══════════╩══════╩═════════════════════╩═════════════════════╝
Is there some elegant way to doing this in python's pandas? Thanks!