Add permanent Adpingid-level exclusions
exclude.json gains an "adpings" map (18 ids, value = package for reference) alongside the existing package list. build_data.py drops those Adpingids from both the 投手 ownership counts and the spend rows. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+9
-3
@@ -2,13 +2,16 @@
|
||||
# 从 xlsx 重算 data.json。
|
||||
# 平台消耗统计: B=Date, C=Adpingid, D=包名, E=地区, I=花费
|
||||
# 投手: B=Adpingid, D=pkg, L=Media Buyer投放人
|
||||
# 规则:@某某 == 某某;未填投放人的 Adpingid 丢弃;exclude.json 里的包名永久剔除(精确匹配)。
|
||||
# 规则:@某某 == 某某;未填投放人的 Adpingid 丢弃;
|
||||
# exclude.json 的 packages(按包名)与 adpings(按 Adpingid)永久剔除,均为精确匹配。
|
||||
# 每个 package 明细:Geo 后缀 = 该 package 花费最高的地区;Adpingid = 该地区内花费最高的 Adping。
|
||||
import openpyxl, collections, json, datetime, os, sys
|
||||
|
||||
HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
SRC = os.path.join(HERE, '2608每日数据-武汉萌奇熊.xlsx')
|
||||
EXCL = set(json.load(open(os.path.join(HERE, 'exclude.json')))['packages'])
|
||||
_cfg = json.load(open(os.path.join(HERE, 'exclude.json')))
|
||||
EXCL = set(_cfg['packages']) # 按包名剔除
|
||||
EXCL_ADP = set(_cfg.get('adpings', {})) # 按 Adpingid 剔除
|
||||
NON_BUYER = {'GP下架'}
|
||||
WINDOW_DAYS = 3
|
||||
|
||||
@@ -20,12 +23,15 @@ def key(v):
|
||||
wb = openpyxl.load_workbook(SRC, data_only=True)
|
||||
|
||||
# --- 投手表:Adpingid -> 投放人 ---
|
||||
amap, dropped_ids = {}, set()
|
||||
amap = {}
|
||||
dropped_ids = set(EXCL_ADP) # 先纳入按 Adpingid 剔除的,再补上按包名命中的
|
||||
for r in wb['投手'].iter_rows(min_row=2, values_only=True):
|
||||
adp, pkg, buyer, status = r[1], r[3], r[11], r[0]
|
||||
if adp is None or str(status).strip() == '示例':
|
||||
continue
|
||||
k = key(adp)
|
||||
if k in EXCL_ADP:
|
||||
continue
|
||||
if pkg is not None and str(pkg).strip() in EXCL: # 精确匹配,避免误伤 in.swiggy.android
|
||||
dropped_ids.add(k)
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user