I am working on a heart rate time series available here. Per dataset description, the series
"contains 1800 evenly-spaced measurements of instantaneous heart rate from a single subject [...] The measurements (in units of beats per minute) occur at 0.5 second intervals, so that the length of each series is exactly 15 minutes."
The dataset itself does not contain an index column. Therefore, I am looking to create one myself. I would like to create a custom datetime
index using pandas
but without the date
part. The size of the time-step should be 0.5 seconds such that the full length becomes 15 minutes as per description above. I have tried with the pd.date_range
function as follows:
index = pd.date_range("1/1/2000",periods=1800, freq='0.5S').time
However, this yields the below output:
Heart Rate
00:00:00 84.2697
00:00:00.500000 84.2697
00:00:01 84.0619
00:00:01.500000 85.6542
00:00:02 87.2093
... ...
00:14:57.500000 103.7900
00:14:58 101.6230
00:14:58.500000 99.5679
00:14:59 99.1835
00:14:59.500000 98.8567
What I would like to obtain is instead something like this:
Heart Rate
00:00 84.2697
00:00.5 84.2697
00:01 84.0619
00:01.5 85.6542
00:02 87.2093
... ...
14:57.5 103.7900
14:58 101.6230
14:58.5 99.5679
14:59 99.1835
14:59.5 98.8567
i.e. dropping the hour
component since it is not applicable and reduce the digits in the fraction of each second since it is always equal to .5. I am not sure how to go about doing this, any help is appreciated!