Browse Source

mvp: 人群分类统计

Signed-off-by: binren <zhangbr@elab-plus.com>
binren 5 years ago
parent
commit
f9276353d3
1 changed files with 22 additions and 1 deletions
  1. 22 1
      mvp.py

+ 22 - 1
mvp.py

@@ -621,7 +621,28 @@ class Mvp:
         return scores, scores['用户画像-行为兴趣']
 
     def people_data(self):
-        return self.people_info()
+        result = self.people_info()
+        a = 0
+        b = 0
+        c = 0
+        d = 0
+        e = 0
+        f = 0
+        for rt in result:
+            crowds = rt.crowd
+            if 'A' in crowds:
+                a += 1
+            if 'B' in crowds:
+                b += 1
+            if 'C' in crowds:
+                c += 1
+            if 'D' in crowds:
+                d += 1
+            if 'E' in crowds:
+                e += 1
+            if 'F' in crowds:
+                f += 1
+        return {'A': a, 'B': b, 'C': b, 'D': d, 'E': e, 'F': f}
 
     def get_crowd_people(self):
         result = {}