I am relatively new to python and pandas. I have a dataset with a date column that starts with a date and then is followed by many rows of timestamps until the next date value appears. Here is some sample data:
7/12/2022
3:47:57AM
3:47:58AM
3:51:27AM
3:52:06AM
7/13/2022
4:18:20AM
4:19:05AM
4:25:51AM
4:27:50AM
I want to use the date value to replace the following timestamps until the next date appears and then use that date to replace the following rows of timestamp values. I want the output to look like the below:
7/12/2022
7/12/2022
7/12/2022
7/12/2022
7/12/2022
7/13/2022
7/13/2022
7/13/2022
7/13/2022
7/13/2022
I am trying to do this in python pandas. Below is the code for dataframe.
df = pd.DataFrame(["7/12/2022","3:47:57AM"," 3:47:58AM","3:51:27AM","3:52:06AM","7/13/2022","4:18:20AM","4:19:05AM","4:25:51AM","4:27:50AM"], columns=['Date'])
Any help would be much appreciated!