简体   繁体   English

查找小于今天的最大日期

[英]Find max date less than today

I'm trying to locate the current date (in this example the date was 1/15/2021) across all columns and return the result in the “current status” column.我试图在所有列中找到当前日期(在本例中,日期为 1/15/2021)并在“当前状态”列中返回结果。

The logic behind this in excel is max(if(B2:E2<=“1/15/2021”,B2:E2)) excel 背后的逻辑是 max(if(B2:E2<=“1/15/2021”,B2:E2))

I'm not sure how to work this out through python我不知道如何通过 python 解决这个问题在此处输入图片说明

Thanks in advance提前致谢

I would just do this我会这样做

from datetime import datetime as dt
df['current status'] = dt.now().date()

this would be the easiest way这将是最简单的方法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM