Browse Source

mvp: 调整 城市 年龄段

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

+ 25 - 20
mvp.py

@@ -22,6 +22,11 @@ class Mvp:
         '90-94年生': '90后',
         '95-99年生': '95后'
     }
+
+    age_list = ['85后', '95后']
+
+    city_list = ['上海市', '上海周边']
+
     tag_table = {
         '用户画像-审美偏好': ['mvp_crowd_info_aesthetic_preference', 'aesthetic_preference'],
         '用户画像-行为兴趣': ['mvp_crowd_info_behavior', 'behavioral_interest'],
@@ -490,26 +495,26 @@ class Mvp:
         else:
             print('获取所有case的数据...')
             # for city in self.citys:
-            # for city in [city]:
-            for age in self.age:
-                for crowd_type in self.crowd:
-                    if age == '85-89年生' and city == '上海市':
-                        print('上海市85后数据导入人工值,无需计算...')
-                        pass
-                    else:
-                        # print(' {}{}'.format(city, age))
-                        # people_uuids = self.get_people_uuid_by_type(crowd_type)
-                        people_uuids = self.people_filter(city, age, crowd)
-                        behavior_data = None
-                        if len(people_uuids) > 0:
-                            print('{}-{}-{}'.format(city, age, crowd_type))
-                            datas = self.behavior_tag_init(city, age, people_uuids)
-                            data_start.append(datas)
-                            all_data, behavior_data_1 = self.calculation_standard_score(datas, city, age, crowd_type)
-                            result.append(all_data)
-                            behavior_data = behavior_data_1
-                        if behavior_data:
-                            module_scores.extend(self.module_score(crowd_type, city, age, behavior_data))
+            for cy in self.city_list:
+                for age in self.age_list:
+                    for crowd_type in self.crowd:
+                        if age == '85-89年生' and cy == '上海市':
+                            print('上海市85后数据导入人工值,无需计算...')
+                            pass
+                        else:
+                            # print(' {}{}'.format(city, age))
+                            # people_uuids = self.get_people_uuid_by_type(crowd_type)
+                            people_uuids = self.people_filter(cy, age, crowd)
+                            behavior_data = None
+                            if len(people_uuids) > 0:
+                                print('{}-{}-{}'.format(cy, age, crowd_type))
+                                datas = self.behavior_tag_init(cy, age, people_uuids)
+                                data_start.append(datas)
+                                all_data, behavior_data_1 = self.calculation_standard_score(datas, cy, age, crowd_type)
+                                result.append(all_data)
+                                behavior_data = behavior_data_1
+                            if behavior_data:
+                                module_scores.extend(self.module_score(crowd_type, cy, age, behavior_data))
         # data_list = []
         # for e in data_start:
         #     for key in e.keys():