2024-04-17 22:16:11 发布
网友
我试图创建一列他的值是两列的减法,但我发现了奇怪的值:
Patient["Waiting"] = Patient["Appointment"] - Patient["Scheduled"] Scheduled Appointment Waiting 2016-04-29 18:38:08 2016-04-29 -1 days +05:21:52
我想知道为什么会出现这些负值??你知道吗
@cᴏʟᴅsᴘᴇᴇᴅ更好地解释:
When two datetime objects are subtracted, the result is a timedelta. Depending on which date was larger, the result could be positive or negative.
另外,如果列中的所有值都没有时间,则不显示时间。你知道吗
Patient["Waiting"] = Patient["Appointment"] - Patient["Scheduled"] 2016-04-29 00:00:00 - 2016-04-29 18:38:08
对于remove negative timedelatas,可以使用^{}:
Patient["Waiting"] = (Patient["Appointment"] - Patient["Scheduled"]).abs()
@cᴏʟᴅsᴘᴇᴇᴅ更好地解释:
另外,如果列中的所有值都没有时间,则不显示时间。你知道吗
对于remove negative timedelatas,可以使用^{} :
相关问题 更多 >
编程相关推荐