瀏覽代碼

group by hardware ID

Xi Ruoyao 5 年之前
父節點
當前提交
2ebda8f01d
共有 1 個文件被更改,包括 9 次插入1 次删除
  1. 9 1
      main.py

+ 9 - 1
main.py

@@ -2,6 +2,7 @@ from sklearn.cluster import DBSCAN
 from sklearn import metrics
 import numpy as np
 import matplotlib.pyplot as plt
+from itertools import groupby
 
 import csv_parser
 import recog
@@ -9,7 +10,14 @@ import metric
 
 if __name__ == '__main__':
     data = csv_parser.parse_data_from_csv('test0714.csv')
-    entries = recog.recognize_entries(data)
+    groups = groupby(data, key = lambda x: x.hwid)
+    entries = []
+    for k, grp in groups:
+        data1 = list(grp)
+        entries1 = recog.recognize_entries(data)
+        for i in entries1:
+            entries.append(i)
+    print(entries)
     x = []
     for e in entries:
         x.append([e.lon, e.lat])