TransWikia.com

Pre-processing data - Dataframe manipulation Time Series

Data Science Asked on June 19, 2021

I have a question in which I’m not entirely sure in which path to take. I’d appreciate if you could point me in the right direction.

Below a screenshot of the a few records of my dataset.

enter image description here

As you can see, all the data is related to the same patient and admission id.

I’m going to tackle this problem using time-series. So, I was told to pre-process this dataset like the following:

Get a block of 12 records. Each block is 4 hours

Look at the 13th block which we want to predict

Check the column death_on_hr to see if there’s a value there. It will contain in which hour the patient died if they did. If it is within that 48 hours block, I create one single row that combines all the 12 rows block with the values and label 1 if they died and 0 if not.

Then, we move one step forward. Now we start from the second row and get a block of 12 and perform the same steps as above until all the records for that patient is done.

I’m confused and how to approach this and maybe there’s an easier way with pandas and numpy that someone could point me towards on how to achieve this.

Here is a screenshot of patient that died within the 48 hours.

enter image description here

Thank you.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP