config.py 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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_MARKET_TYPE_NAME": {"method": "fillna", "opt": "fill", "value": "其它", "type": "str"},
  29. "BB_RTL_CUST_SUB_BUSI_PLACE_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. class ProductConfig:
  44. FEATURE_COLUMNS = [
  45. "product_code", # 商品编码
  46. # "factory_name", # 工业公司名称
  47. # "brand_code", # 品牌编码
  48. "adjust_price", # 含税调拨价
  49. "notwithtax_adjust_price", # 不含税调拨价
  50. "whole_sale_price", # 统一批发价
  51. "direct_retail_price", # 建议零售价
  52. "allot_price", # 调拨价
  53. "direct_whole_price", # 批发指导价
  54. "retail_price", # 零售价
  55. "price_type_name", # 卷烟价类名称
  56. "gear_type_name", # 卷烟档位名称
  57. "category_type_name", # 卷烟品类名称
  58. "is_key_brand", # 是否重点品牌
  59. "is_high_level", # 是否高端烟
  60. "is_upscale_level", # 是否高端烟不含高价
  61. "is_high_price", # 是否高价烟
  62. "is_low_price", # 是否低价烟
  63. "is_low_tar", # 是否低焦油烟
  64. "is_encourage", # 是否全国鼓励品牌
  65. "is_abnormity", # 是否异形包装
  66. "is_intake", # 是否进口烟
  67. "is_short", # 是否紧俏品牌
  68. "is_medium", # 是否中支烟
  69. "is_shortbranch", # 是否短支烟
  70. "is_ordinary_price_type", # 是否普一类烟
  71. "source_type", # 来源类型
  72. "tar_qty", # 焦油含量
  73. "product_style_code_name", # 包装类型名称
  74. "chinese_mix", # 中式混合
  75. "sub_price_type_name", # 细分卷烟价类名称
  76. ]
  77. CLEANING_RULES = {
  78. "adjust_price": {"method": "fillna", "opt": "mean", "type": "num"},
  79. "notwithtax_adjust_price": {"method": "fillna", "opt": "mean", "type": "num"},
  80. "whole_sale_price": {"method": "fillna", "opt": "mean", "type": "num"},
  81. "direct_retail_price": {"method": "fillna", "opt": "mean", "type": "num"},
  82. "allot_price": {"method": "fillna", "opt": "fill", "type": "num", "value": 0.0},
  83. "direct_whole_price": {"method": "fillna", "opt": "mean", "type": "num"},
  84. "retail_price": {"method": "fillna", "opt": "mean", "type": "num"},
  85. "price_type_name": {"method": "fillna", "opt": "fill", "type": "str", "value": "其他"},
  86. "gear_type_name": {"method": "fillna", "opt": "fill", "type": "str", "value": "其他"},
  87. "category_type_name": {"method": "fillna", "opt": "fill", "type": "str", "value": "其他"},
  88. "is_key_brand": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  89. "is_high_level": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  90. "is_upscale_level": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  91. "is_high_price": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  92. "is_low_price": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  93. "is_low_tar": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  94. "is_encourage": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  95. "is_abnormity": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  96. "is_intake": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  97. "is_short": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  98. "is_medium": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  99. "is_shortbranch": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  100. "is_ordinary_price_type": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  101. "source_type": {"method": "fillna", "opt": "fill", "type": "str", "value": "其他"},
  102. "tar_qty": {"method": "fillna", "opt": "mean", "type": "num"},
  103. "product_style_code_name": {"method": "fillna", "opt": "fill", "type": "str", "value": "其他"},
  104. "chinese_mix": {"method": "fillna", "opt": "fill", "type": "str", "value": "否"},
  105. "sub_price_type_name": {"method": "fillna", "opt": "fill", "type": "str", "value": "其他"},
  106. }