我的数据集看起来像这样 Tr, Date, TimeAV81312,20161014,121000AV81312,20161014,160221AV85012,20170422,150858AV85012,20161108,11137AV86157,20170426,45747AV86157,20170426,45744AV86157,20160813,134312我只需要从每个Tr具有最新记录的项目中选择一项,即日期和时间更高的最新记录所需的输出是 Tr, Date, TimeAV81312,20161014,160221AV85012,20170422,150858AV86157,20170426,45747我的代码是df2 = read_csv("sample.csv")df2 = df2.valuesx = []for i in df2: for j in df2: if i[2] == j[2]: if i[3] >= j[3]: x.append(i) 它没有按预期工作
添加回答
举报
0/150
提交
取消