使用時間戳刪除重複行你好,
我附有一個示例數據表,其中我希望使用 TimeStamp,Tool 列刪除數據集中的重複行。
複製標準:
同一工具上 6 分鐘內的時間戳被視為重複,必須刪除這些行。
有人可以幫助如何在 JSL 中實現這一目標嗎?
謝謝!
@txnelson
分析數據表腳本編寫視窗回复:使用時間戳刪除重複行我相信這會給你一個關於如何處理你的問題的例子
Names Default To Here( 1 );
dt = Current Data Table();
// Loop through the data table deleting all duplicate rows
i = 1;
While( i <= N Rows( dt ),
// Find the upper and lower bounds to match on
lower = :timeStamp[i] - In Minutes( 6 );
upper = :timeStamp[i] + In Minutes( 6 );
// Find the rows that match
theRows = dt << get rows where( :timeStamp > lower & :timeStamp < upper );
// Remove the current row from the list. We do not want to delete it
Try( theRows[1] = [] );
// Delete the remaining rows
Try( dt << delete rows( theRows ) );
// Increment the row to work on
i++;
);
回复:使用時間戳刪除重複行你好羅恩,
我嘗試了您的解決方案,但發現結果存在問題。
我附上了運行你的代碼的結果。 由於某種原因,它似乎沒有捕捉到幾個重複的條目。
謝謝。