我正在嘗試在資料框中查找在特定日期有效的行
資料框:
idx start end
0 2019-08-23 2019-12-31
1 2018-01-01 2018-07-05
2 2020-04-01 2020-11-27
3 2018-03-24 2018-06-18
查找在 2018-05-16 上有效的值
結果:
idx start end
1 2018-01-01 2018-07-05
3 2018-03-24 2018-06-18
如何過濾掉所有其他條目?
uj5u.com熱心網友回復:
offset = (df['wished_date'] > start_date) & (df['wished_date'] <= end_date)
df = df.loc[offset]
df
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/370302.html
上一篇:具有多個url的PHPfile_get_contents
下一篇:JSON模式中的日期物件
