2
我有一個數據框(df),其中列A是在時間戳給定的時間點給藥的藥物單位。我想填補缺失的數值(NaN)與給定藥物半衰期(180分鐘)的藥物濃度。我在熊貓的代碼中掙扎。真的很感謝幫助和見解。在此先感謝當半衰期已知時,如何填補藥物/藥物不規則時間序列的缺失值
df
A
Timestamp
1991-04-21 09:09:00 9.0
1991-04-21 3:00:00 NaN
1991-04-21 9:00:00 NaN
1991-04-22 07:35:00 10.0
1991-04-22 13:40:00 NaN
1991-04-22 16:56:00 NaN
鑑於該藥的半衰期爲180分鐘。我想fillna(值)作爲經過時間的函數和藥物
像
Timestamp A
1991-04-21 09:00:00 9.0
1991-04-21 3:00:00 ~2.25
1991-04-21 9:00:00 ~0.55
1991-04-22 07:35:00 10.0
1991-04-22 13:40:00 ~2.5
1991-04-22 16:56:00 ~0.75
非常感謝您。那太完美了! – Pearl
@珍珠很高興我可以幫忙。 – piRSquared