У меня есть следующий DataFrame:
dataPoint RIC ExpirationDate Exchange Description \
closingDate
2002-10-15 4207 SPH3 2003-03-20 CME:Index and Options Market
2002-10-15 5400 SPH4 2004-03-18 CME:Index and Options Market
2002-10-15 18661 SPM3 2003-06-19 CME:Index and Options Market
2002-10-15 19918 SPM4 2004-06-17 CME:Index and Options Market
2002-10-15 33439 SPU3 2003-09-18 CME:Index and Options Market
2002-10-15 35523 SPU4 2004-09-16 CME:Index and Options Market
2002-10-15 47733 SPZ2 2002-12-19 CME:Index and Options Market
2002-10-15 49022 SPZ3 2003-12-18 CME:Index and Options Market
Я хочу получить строку с ExpirationDate, ближайшей к моему ClosingDate (обратите внимание, что у меня есть статическая переменная ClosingDate, хранящаяся в переменной с именем current_date).
df.iterrows () - это одно решение, которое приходит на ум, но кажется неэффективным. Есть ли оптимальный метод выполнения этого условного отбора?