我使用以下数据:
date latitude route name longitude
2009-04-11 00:50:31.640000 40.80708 White Loop 86 -77.85891
2009-04-11 00:50:27.718000 40.80708 White Loop 86 -77.85891
2009-04-11 00:50:01.562000 40.80708 White Loop 86 -77.85891
2009-04-11 00:49:48.765000 40.80708 White Loop 86 -77.85891
2009-04-11 00:49:34.796000 40.802338 White Loop 86 -77.85073
2009-04-11 00:49:22.468000 40.802338 White Loop 86 -77.85073
2009-04-11 00:48:35.671000 40.802338 White Loop 86 -77.85073
2009-04-11 00:48:29.125000 40.802338 White Loop 86 -77.85073
2009-04-11 00:47:19.906000 40.79889 White Loop 86 -77.85299
2009-04-11 00:47:03.609000 40.79889 White Loop 86 -77.85299
2009-04-11 00:46:54.437000 40.79889 White Loop 86 -77.85299
2009-04-11 00:46:52.687000 40.79889 White Loop 86 -77.85299
2009-04-11 00:46:51.125000 40.79889 White Loop 86 -77.85299
2009-04-11 00:46:48.578000 40.79889 White Loop 86 -77.85299
2009-04-11 00:46:41.406000 40.79889 White Loop 86 -77.85299
2009-04-11 00:50:31.687000 40.792194 White Loop 82 -77.863235
2009-04-11 00:50:27.781000 40.792194 White Loop 82 -77.863235
2009-04-11 00:50:01.640000 40.792194 White Loop 82 -77.863235
2009-04-11 00:49:48.812000 40.792194 White Loop 82 -77.863235
2009-04-11 00:49:34.843000 40.794914 White Loop 82 -77.866844
2009-04-11 00:49:22.531000 40.794914 White Loop 82 -77.866844
2009-04-11 00:48:35.718000 40.794914 White Loop 82 -77.866844
2009-04-11 00:48:29.156000 40.79738 White Loop 82 -77.86755
2009-04-11 00:47:19.984000 40.79738 White Loop 82 -77.86755
2009-04-11 00:47:03.656000 40.79738 White Loop 82 -77.86755
2009-04-11 00:46:54.484000 40.79738 White Loop 82 -77.86755
2009-04-11 00:46:52.734000 40.79738 White Loop 82 -77.86755
2009-04-11 00:46:51.156000 40.79738 White Loop 82 -77.86755
2009-04-11 00:46:48.640000 40.79738 White Loop 82 -77.86755
2009-04-11 00:46:41.453000 40.79738 White Loop 82 -77.86755
2009-04-11 00:50:31.656000 40.776066 White Loop 81 -77.88552
2009-04-11 00:50:27.750000 40.776066 White Loop 81 -77.88552
2009-04-11 00:50:01.593000 40.776066 White Loop 81 -77.88552
2009-04-11 00:49:48.796000 40.776066 White Loop 81 -77.88552
2009-04-11 00:49:34.812000 40.764687 White Loop 81 -77.88271
2009-04-11 00:49:22.515000 40.764687 White Loop 81 -77.88271
2009-04-11 00:48:35.703000 40.764687 White Loop 81 -77.88271
2009-04-11 00:48:29.140000 40.764687 White Loop 81 -77.88271
2009-04-11 00:47:19.937000 40.76335 White Loop 81 -77.876755
2009-04-11 00:47:03.640000 40.76335 White Loop 81 -77.876755
2009-04-11 00:46:54.468000 40.76335 White Loop 81 -77.876755
2009-04-11 00:46:52.718000 40.76335 White Loop 81 -77.876755
2009-04-11 00:46:51.156000 40.76335 White Loop 81 -77.876755
2009-04-11 00:46:48.609000 40.76335 White Loop 81 -77.876755
2009-04-11 00:46:41.437000 40.76335 White Loop 81 -77.876755
如何优化查询以仅获取每个“名称”的最新行?例如,我只想结束:
2009-04-11 00:50:31.640000 40.80708 White Loop 86 -77.85891
2009-04-11 00:50:31.687000 40.792194 White Loop 82 -77.863235
2009-04-11 00:50:31.656000 40.776066 White Loop 81 -77.88552
我希望所有结果的日期值都不超过 1 分钟。请记住,日期值是 Python 日期时间属性。
谢谢