config.py 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. class CustConfig:
  2. FEATURE_COLUMNS = [
  3. "BB_RETAIL_CUSTOMER_CODE", # 零售户代码
  4. "BB_RTL_CUST_POSITION_TYPE_NAME", # 零售户商圈类型名称
  5. "BB_RTL_CUST_MARKET_TYPE_NAME", # 零售户市场类型名称
  6. # "BB_RTL_CUST_BUSINESS_TYPE_NAME", # 零售户业态名称
  7. "BB_RTL_CUST_SUB_BUSI_PLACE_NAME", # 零售户业态细分名称
  8. "BB_RTL_CUST_GRADE_NAME", # 零售户分档名称
  9. # "BB_RTL_CUST_TERMINAL_LEVEL_NAME", # 零售户终端层级名称
  10. # "BB_RTL_CUST_TERMINALEVEL_NAME", # 零售户终端层级细分名称
  11. # "MD04_MG_RTL_CUST_CREDITCLASS_NAME", # 零售户信用等级名称
  12. # "MD04_MG_SAMPLE_CUST_FLAG", # 样本户标识
  13. # "MD07_RTL_CUST_IS_SALE_LARGE_FLAG", # 零售户大户标识
  14. # "BB_CUSTOMER_MANAGER_SCOPE_NAME", # 零售户经营范围名称
  15. # "BB_RTL_CUST_OPERATE_METHOD_NAME", # 零售户经营方式名称
  16. # "BB_RTL_CUST_CGT_OPERATE_SCOPE_NAME", # 零售户卷烟经营规模名称
  17. "BB_RTL_CUST_CHAIN_FLAG", # 零售户连锁标识
  18. "MD04_DIR_SAL_STORE_FLAG", # 直营店标识
  19. "STORE_AREA", # 店铺经营面积
  20. "OPERATOR_AGE", # 经营者年龄
  21. "OPERATOR_EDU_LEVEL", # 零售客户经营者文化程
  22. # "AVERAGE_CONSUMER_FLOW", # 月均消费人流
  23. # "NEW_PRODUCT_MEMBERS_QTY", # 新品消费会员数量
  24. ]
  25. # 数据清洗规则
  26. CLEANING_RULES = {
  27. "BB_RTL_CUST_POSITION_TYPE_NAME": {"method": "fillna", "opt": "fill", "value": "其他", "type": "str"},
  28. "BB_RTL_CUST_SUB_BUSI_PLACE_NAME": {"method": "fillna", "opt": "fill", "value": "其他", "type": "str"},
  29. "BB_RTL_CUST_GRADE_NAME": {"method": "fillna", "opt": "fill", "value": "其他", "type": "str"},
  30. # "BB_RTL_CUST_TERMINALEVEL_NAME": {"method": "fillna", "opt": "replace", "value": "BB_RTL_CUST_TERMINAL_LEVEL_NAME", "type": "str"},
  31. # "MD04_MG_RTL_CUST_CREDITCLASS_NAME": {"method": "fillna", "opt": "fill", "value": "未评价", "type": "str"},
  32. # "MD04_MG_SAMPLE_CUST_FLAG": {"method": "fillna", "value": "N", "opt": "fill"},
  33. # "MD07_RTL_CUST_IS_SALE_LARGE_FLAG": {"method": "fillna", "value": "N", "opt": "fill"},
  34. "BB_RTL_CUST_CHAIN_FLAG": {"type": "fillna", "opt": "fill", "value": "0", "type": "str"},
  35. # "BB_RTL_CUST_CGT_OPERATE_SCOPE_NAME": {"method": "fillna", "value": "中", "opt": "fill"},
  36. "BB_RTL_CUST_CHAIN_FLAG": {"method": "fillna", "opt": "fill", "value": "0", "type": "str"},
  37. "MD04_DIR_SAL_STORE_FLAG": {"method": "fillna", "opt": "fill", "value": "0", "type": "str"},
  38. "STORE_AREA": {"method": "fillna", "opt": "mean", "type": "num"},
  39. "OPERATOR_AGE": {"method": "fillna", "opt": "mean", "type": "num"},
  40. "OPERATOR_EDU_LEVEL": {"method": "fillna", "opt": "fill", "value": "00", "type": "str"},
  41. }
  42. # one-hot编码
  43. ONEHOT = [
  44. "BB_RTL_CUST_POSITION_TYPE_NAME",
  45. "BB_RTL_CUST_MARKET_TYPE_NAME",
  46. "BB_RTL_CUST_SUB_BUSI_PLACE_NAME",
  47. "BB_RTL_CUST_GRADE_NAME",
  48. "BB_RTL_CUST_CHAIN_FLAG",
  49. "MD04_DIR_SAL_STORE_FLAG",
  50. "OPERATOR_EDU_LEVEL",
  51. ]
  52. class ProductConfig:
  53. FEATURE_COLUMNS = [
  54. "product_code", # 商品编码
  55. # "factory_name", # 工业公司名称
  56. # "brand_code", # 品牌编码
  57. "adjust_price", # 含税调拨价
  58. "notwithtax_adjust_price", # 不含税调拨价
  59. "whole_sale_price", # 统一批发价
  60. "direct_retail_price", # 建议零售价
  61. "allot_price", # 调拨价
  62. "direct_whole_price", # 批发指导价
  63. "retail_price", # 零售价
  64. "price_type_name", # 卷烟价类名称
  65. "gear_type_name", # 卷烟档位名称
  66. "category_type_name", # 卷烟品类名称
  67. "is_key_brand", # 是否重点品牌
  68. "is_high_level", # 是否高端烟
  69. "is_upscale_level", # 是否高端烟不含高价
  70. "is_high_price", # 是否高价烟
  71. "is_low_price", # 是否低价烟
  72. "is_low_tar", # 是否低焦油烟
  73. "is_encourage", # 是否全国鼓励品牌
  74. "is_abnormity", # 是否异形包装
  75. "is_intake", # 是否进口烟
  76. "is_short", # 是否紧俏品牌
  77. "is_medium", # 是否中支烟
  78. "is_shortbranch", # 是否短支烟
  79. "is_ordinary_price_type", # 是否普一类烟
  80. "source_type", # 来源类型
  81. "tar_qty", # 焦油含量
  82. "product_style_code_name", # 包装类型名称
  83. "chinese_mix", # 中式混合
  84. "sub_price_type_name", # 细分卷烟价类名称
  85. ]
  86. CLEANING_RULES = {
  87. "adjust_price": {"method": "fillna", "opt": "mean", "type": "num"},
  88. "notwithtax_adjust_price": {"method": "fillna", "opt": "mean", "type": "num"},
  89. "whole_sale_price": {"method": "fillna", "opt": "mean", "type": "num"},
  90. "direct_retail_price": {"method": "fillna", "opt": "mean", "type": "num"},
  91. "allot_price": {"method": "fillna", "opt": "fill", "type": "num", "value": 0.0},
  92. "direct_whole_price": {"method": "fillna", "opt": "mean", "type": "num"},
  93. "retail_price": {"method": "fillna", "opt": "mean", "type": "num"},
  94. "price_type_name": {"method": "fillna", "opt": "fill", "type": "str", "value": "其他"},
  95. "gear_type_name": {"method": "fillna", "opt": "fill", "type": "str", "value": "其他"},
  96. "category_type_name": {"method": "fillna", "opt": "fill", "type": "str", "value": "其他"},
  97. "is_key_brand": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  98. "is_high_level": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  99. "is_upscale_level": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  100. "is_high_price": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  101. "is_low_price": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  102. "is_low_tar": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  103. "is_encourage": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  104. "is_abnormity": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  105. "is_intake": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  106. "is_short": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  107. "is_medium": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  108. "is_shortbranch": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  109. "is_ordinary_price_type": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  110. "source_type": {"method": "fillna", "opt": "fill", "type": "str", "value": "其他"},
  111. "tar_qty": {"method": "fillna", "opt": "mean", "type": "num"},
  112. "product_style_code_name": {"method": "fillna", "opt": "fill", "type": "str", "value": "其他"},
  113. "chinese_mix": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  114. "sub_price_type_name": {"method": "fillna", "opt": "fill", "type": "str", "value": "其他"},
  115. }
  116. ONEHOT = [
  117. "price_type_name", # 卷烟价类名称
  118. "gear_type_name", # 卷烟档位名称
  119. "category_type_name", # 卷烟品类名称
  120. "is_key_brand", # 是否重点品牌
  121. "is_high_level", # 是否高端烟
  122. "is_upscale_level", # 是否高端烟不含高价
  123. "is_high_price", # 是否高价烟
  124. "is_low_price", # 是否低价烟
  125. "is_low_tar", # 是否低焦油烟
  126. "is_encourage", # 是否全国鼓励品牌
  127. "is_abnormity", # 是否异形包装
  128. "is_intake", # 是否进口烟
  129. "is_short", # 是否紧俏品牌
  130. "is_medium", # 是否中支烟
  131. "is_shortbranch", # 是否短支烟
  132. "is_ordinary_price_type", # 是否普一类烟
  133. "source_type", # 来源类型
  134. "product_style_code_name", # 包装类型名称
  135. "chinese_mix", # 中式混合
  136. "sub_price_type_name", # 细分卷烟价类名称
  137. ]