config.py 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. class CustConfig:
  2. FEATURE_COLUMNS = [
  3. "BB_RETAIL_CUSTOMER_CODE", # 零售户代码
  4. "BB_RTL_CUST_GRADE_NAME", # 零售户分档名称
  5. "BB_RTL_CUST_MARKET_TYPE_NAME", # 零售户市场类型名称
  6. "STORE_AREA", # 店铺经营面积
  7. "BB_RTL_CUST_BUSINESS_TYPE_NAME", # 零售户业态名称
  8. "OPERATOR_EDU_LEVEL", # 零售客户经营者文化程
  9. "OPERATOR_AGE", # 经营者年龄
  10. "BB_RTL_CUST_CHAIN_FLAG", # 零售户连锁标识
  11. "PRESENT_STAR_TERMINAL", # 终端星级
  12. "MD04_MG_RTL_CUST_CREDITCLASS_NAME", # 零售户信用等级名称
  13. "MD04_DIR_SAL_STORE_FLAG", # 直营店标识
  14. "NEW_PRODUCT_MEMBERS_QTY_SAMEPRICE_OCC", # 新品订货量占同价类比重
  15. "PRODUCT_LISTING_RATE", # 品规上架率
  16. # "STOCKOUT_DAYS", # 断货天数
  17. # "YLT_TURNOVER_RATE", # 易灵通动销率
  18. # "YLT_BAR_PACKAGE_SALE_OCC", # 易灵通条包销售占比
  19. # "PRODUCT_INSALE_QTY", # 在销品规数
  20. # "UNPACKING_RATE", # 拆包率
  21. # "BB_RTL_CUST_POSITION_TYPE_NAME", # 零售户商圈类型名称
  22. # "BB_RTL_CUST_SUB_BUSI_PLACE_NAME", # 零售户业态细分名称
  23. # "BB_RTL_CUST_TERMINAL_LEVEL_NAME", # 零售户终端层级名称
  24. # "BB_RTL_CUST_TERMINALEVEL_NAME", # 零售户终端层级细分名称
  25. # "MD04_MG_SAMPLE_CUST_FLAG", # 样本户标识
  26. # "MD07_RTL_CUST_IS_SALE_LARGE_FLAG", # 零售户大户标识
  27. # "BB_CUSTOMER_MANAGER_SCOPE_NAME", # 零售户经营范围名称
  28. # "BB_RTL_CUST_OPERATE_METHOD_NAME", # 零售户经营方式名称
  29. # "BB_RTL_CUST_CGT_OPERATE_SCOPE_NAME", # 零售户卷烟经营规模名称
  30. # "AVERAGE_CONSUMER_FLOW", # 月均消费人流
  31. # "NEW_PRODUCT_MEMBERS_QTY", # 新品消费会员数量
  32. ]
  33. # 数据清洗规则
  34. CLEANING_RULES = {
  35. "BB_RTL_CUST_GRADE_NAME": {"method": "fillna", "opt": "fill", "value": "十五档", "type": "str"},
  36. "BB_RTL_CUST_MARKET_TYPE_NAME": {"method": "fillna", "opt": "fill", "value": "城网", "type": "str"},
  37. "STORE_AREA": {"method": "fillna", "opt": "mean", "type": "num"},
  38. "BB_RTL_CUST_BUSINESS_TYPE_NAME": {"method": "fillna", "opt": "fill", "value": "其他", "type": "str"},
  39. "OPERATOR_EDU_LEVEL": {"method": "fillna", "opt": "fill", "value": "无数据", "type": "str"},
  40. "OPERATOR_AGE": {"method": "fillna", "opt": "mean", "type": "num"},
  41. "BB_RTL_CUST_CHAIN_FLAG": {"method": "fillna", "opt": "fill", "value": "否", "type": "str"},
  42. "PRESENT_STAR_TERMINAL": {"method": "fillna", "opt": "fill", "value": "非星级", "type": "str"},
  43. "MD04_MG_RTL_CUST_CREDITCLASS_NAME": {"method": "fillna", "opt": "fill", "value": "D", "type": "str"},
  44. "MD04_DIR_SAL_STORE_FLAG": {"method": "fillna", "opt": "fill", "value": "否", "type": "str"},
  45. "NEW_PRODUCT_MEMBERS_QTY_SAMEPRICE_OCC": {"method": "fillna", "opt": "mean", "type": "num"},
  46. "PRODUCT_LISTING_RATE": {"method": "fillna", "opt": "mean", "type": "num"},
  47. # "STOCKOUT_DAYS": {"method": "fillna", "opt": "mean", "type": "num"},
  48. # "YLT_TURNOVER_RATE": {"method": "fillna", "opt": "mean", "type": "num"},
  49. # "NEW_PRODUCT_MEMBERS_QTY": {"method": "fillna", "opt": "mean", "type": "num"},
  50. # "PRODUCT_INSALE_QTY": {"method": "fillna", "opt": "mean", "type": "num"},
  51. # "UNPACKING_RATE": {"method": "fillna", "opt": "mean", "type": "num"},
  52. # "BB_RTL_CUST_POSITION_TYPE_NAME": {"method": "fillna", "opt": "fill", "value": "其他", "type": "str"},
  53. # "BB_RTL_CUST_SUB_BUSI_PLACE_NAME": {"method": "fillna", "opt": "fill", "value": "其他", "type": "str"},
  54. # "BB_RTL_CUST_TERMINALEVEL_NAME": {"method": "fillna", "opt": "replace", "value": "BB_RTL_CUST_TERMINAL_LEVEL_NAME", "type": "str"},
  55. # "MD04_MG_SAMPLE_CUST_FLAG": {"method": "fillna", "value": "N", "opt": "fill"},
  56. # "MD07_RTL_CUST_IS_SALE_LARGE_FLAG": {"method": "fillna", "value": "N", "opt": "fill"},
  57. # "BB_RTL_CUST_CGT_OPERATE_SCOPE_NAME": {"method": "fillna", "value": "中", "opt": "fill"},
  58. }
  59. ONEHOT_CAT = {
  60. "BB_RTL_CUST_GRADE_NAME": ['一档', '二档', '三档', '四档', '五档', '六档', '七档', '八档', '九档', '十档', '十一档', '十二档',
  61. '十三档', '十四档', '十五档', '十六档', '十七档', '十八档', '十九档', '二十档', '二十一档', '二十二档',
  62. '二十三档', '二十四档', '二十五档', '二十六档', '二十七档', '二十八档', '二十九档', '三十档'],
  63. "BB_RTL_CUST_MARKET_TYPE_NAME": ["城网", "农网"],
  64. "BB_RTL_CUST_BUSINESS_TYPE_NAME": ["便利店", "超市", "烟草专业店", "娱乐服务类", "其他"],
  65. "OPERATOR_EDU_LEVEL": [1, 2, 3, 4, 5, 6, 7, "无数据"],
  66. "BB_RTL_CUST_CHAIN_FLAG": ["是", "否"],
  67. "PRESENT_STAR_TERMINAL": ["一星", "二星", "三星", "四星", "五星", "非星级"],
  68. "MD04_MG_RTL_CUST_CREDITCLASS_NAME": ["AAA", "AA", "A", "B", "C", "D"],
  69. "MD04_DIR_SAL_STORE_FLAG": ["是", "否"],
  70. # "BB_RTL_CUST_POSITION_TYPE_NAME": ["居民区", "商业娱乐区", "交通枢纽区", "旅游景区", "工业区", "集贸区", "院校学区", "办公区", "其他"]
  71. }
  72. class ProductConfig:
  73. FEATURE_COLUMNS = [
  74. "product_code", # 商品编码
  75. "direct_retail_price", # 建议零售价
  76. "is_low_tar", # 是否低焦油烟
  77. "tar_qty", # 焦油含量
  78. "is_exploding_beads", # 是否爆珠
  79. "is_shortbranch", # 是否短支烟
  80. "is_medium", # 是否中支烟
  81. "is_tiny", # 是否细支
  82. "product_style_code_name", # 包装类型名称
  83. "org_is_abnormity", # 是否异形包装
  84. "is_chuangxin", # 是否创新品类
  85. "is_key_brand", # 是否重点品牌
  86. "foster_level_hy", # 是否行业共育品规
  87. "foster_level_sj", # 是否省级共育品规
  88. "is_cigar", # 是否雪茄型卷烟
  89. "co_qty", # 一氧化碳含量
  90. "tbc_total_length", # 烟支总长度
  91. "tbc_length", # 烟支长度
  92. "filter_length", # 滤嘴长度
  93. # "adjust_price", # 含税调拨价
  94. # "notwithtax_adjust_price", # 不含税调拨价
  95. # "whole_sale_price", # 统一批发价
  96. # "allot_price", # 调拨价
  97. # "direct_whole_price", # 批发指导价
  98. # "retail_price", # 零售价
  99. # "price_type_name", # 卷烟价类名称
  100. # "gear_type_name", # 卷烟档位名称
  101. # "category_type_name", # 卷烟品类名称
  102. # "is_high_level", # 是否高端烟
  103. # "is_upscale_level", # 是否高端烟不含高价
  104. # "is_high_price", # 是否高价烟
  105. # "is_low_price", # 是否低价烟
  106. # "is_encourage", # 是否全国鼓励品牌
  107. # "is_abnormity", # 是否异形包装
  108. # "is_intake", # 是否进口烟
  109. # "is_short", # 是否紧俏品牌
  110. # "is_ordinary_price_type", # 是否普一类烟
  111. # "source_type", # 来源类型
  112. # "chinese_mix", # 中式混合
  113. # "sub_price_type_name", # 细分卷烟价类名称
  114. ]
  115. CLEANING_RULES = {
  116. "direct_retail_price": {"method": "fillna", "opt": "mean", "type": "num"},
  117. "is_low_tar": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  118. "tar_qty": {"method": "fillna", "opt": "mean", "type": "num"},
  119. "is_exploding_beads": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  120. "is_shortbranch": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  121. "is_medium": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  122. "product_style_code_name": {"method": "fillna", "opt": "fill", "type": "str", "value": "其他"},
  123. "org_is_abnormity": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  124. "is_chuangxin": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  125. "is_key_brand": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  126. "foster_level_hy": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  127. "foster_level_sj": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  128. "is_cigar": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  129. "co_qty": {"method": "fillna", "opt": "mean", "type": "num"},
  130. "tbc_total_length": {"method": "fillna", "opt": "mean", "type": "num"},
  131. "tbc_length": {"method": "fillna", "opt": "mean", "type": "num"},
  132. "filter_length": {"method": "fillna", "opt": "mean", "type": "num"},
  133. # "adjust_price": {"method": "fillna", "opt": "mean", "type": "num"},
  134. # "notwithtax_adjust_price": {"method": "fillna", "opt": "mean", "type": "num"},
  135. # "whole_sale_price": {"method": "fillna", "opt": "mean", "type": "num"},
  136. # "allot_price": {"method": "fillna", "opt": "fill", "type": "num", "value": 0.0},
  137. # "direct_whole_price": {"method": "fillna", "opt": "mean", "type": "num"},
  138. # "retail_price": {"method": "fillna", "opt": "mean", "type": "num"},
  139. # "price_type_name": {"method": "fillna", "opt": "fill", "type": "str", "value": "一类烟"},
  140. # "gear_type_name": {"method": "fillna", "opt": "fill", "type": "str", "value": "其他"},
  141. # "category_type_name": {"method": "fillna", "opt": "fill", "type": "str", "value": "其他"},
  142. # "is_high_level": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  143. # "is_upscale_level": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  144. # "is_high_price": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  145. # "is_low_price": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  146. # "is_encourage": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  147. # "is_abnormity": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  148. # "is_intake": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  149. # "is_short": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  150. # "is_ordinary_price_type": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  151. # "source_type": {"method": "fillna", "opt": "fill", "type": "str", "value": "其他"},
  152. # "chinese_mix": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  153. # "sub_price_type_name": {"method": "fillna", "opt": "fill", "type": "str", "value": "普一类烟"},
  154. }
  155. ONEHOT_CAT = {
  156. "is_low_tar": ["是", "否"],
  157. "is_exploding_beads": ["是", "否"],
  158. "is_shortbranch": ["是", "否"],
  159. "is_medium": ["是", "否"],
  160. "product_style_code_name": ["条盒硬盒", "条包硬盒", "条盒软盒", "条包软盒", "铁盒", "其他"],
  161. "org_is_abnormity": ["是", "否"],
  162. "is_chuangxin": ["是", "否"],
  163. "is_key_brand": ["是", "否"],
  164. "foster_level_hy": ["是", "否"],
  165. "foster_level_sj": ["是", "否"],
  166. "is_cigar": ["是", "否"],
  167. # "price_type_name": ["一类烟", "二类烟", "三类烟", "四类烟", "五类烟", "无价类"],
  168. # "gear_type_name": ["第一档位", "第二档位", "第三档位", "第四档位", "第五档位", "第六档位", "第七档位", "第八档位", "其他"],
  169. # "category_type_name": ["第1品类", "第2品类", "第3品类", "第4品类", "第5品类", "第6品类", "第7品类",
  170. # "第8品类", "第9品类", "第10品类", "第11品类", "第12品类", "第13品类", "其他"],
  171. # "is_high_level": ["是", "否"],
  172. # "is_upscale_level": ["是", "否"],
  173. # "is_high_price": ["是", "否"],
  174. # "is_low_price": ["是", "否"],
  175. # "is_encourage": ["是", "否"],
  176. # "is_abnormity": ["是", "否"],
  177. # "is_intake": ["是", "否"],
  178. # "is_short": ["是", "否"],
  179. # "is_ordinary_price_type": ["是", "否"],
  180. # "source_type": ["是", "否"],
  181. # "chinese_mix": ["是", "否"],
  182. # "sub_price_type_name": ["高端烟", "高价位烟", "普一类烟", "二类烟", "三类烟", "四类烟", "五类烟", "无价类"],
  183. }