I have a pandas dataframe contains the following columns:
sate_1 state_2
----- -----
New York Washington
Ohio Utah
what I want to do is to construct an input date for each distinct combination of state_1 and state_2 so the results would be:
sate_1 state_2 date_time
New York Washington 2017-11-01 00:00
New York Washington 2017-11-01 03:00
New York Washington 2017-11-01 06:00
Ohio Utah 2017-11-01 00:00
Ohio Utah 2017-11-01 03:00
Ohio Utah 2017-11-01 06:00
so basically for each distinct row I want to return 3 time periods starting from today,s date. I have the logic to get the datetime but I'm doing this through a loop of all the records which is a time consuming since my data would contain more than 1M rows . I was wondering is there a way to do this using the apply function, which I'm assuming it will be much faster.