mdbq 2.4.7__py3-none-any.whl → 2.4.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
mdbq/aggregation/query_data.py
CHANGED
@@ -1002,8 +1002,14 @@ class GroupBy:
|
|
1002
1002
|
# 下面是添加人群 AIPL 分类
|
1003
1003
|
dir_file = f'\\\\192.168.1.198\\时尚事业部\\01.运营部\\0-电商周报-每周五更新\\分类配置文件.xlsx'
|
1004
1004
|
dir_file2 = '/Volumes/时尚事业部/01.运营部/0-电商周报-每周五更新/分类配置文件.xlsx'
|
1005
|
+
if platform.system() == 'Windows':
|
1006
|
+
dir_file3 = 'C:\\同步空间\\BaiduSyncdisk\\原始文件2\\分类配置文件.xlsx'
|
1007
|
+
else:
|
1008
|
+
dir_file3 = '/Users/xigua/数据中心/原始文件2/分类配置文件.xlsx'
|
1005
1009
|
if not os.path.isfile(dir_file):
|
1006
1010
|
dir_file = dir_file2
|
1011
|
+
if not os.path.isfile(dir_file):
|
1012
|
+
dir_file = dir_file3
|
1007
1013
|
if os.path.isfile(dir_file):
|
1008
1014
|
df_fl = pd.read_excel(dir_file, sheet_name='人群分类', header=0)
|
1009
1015
|
df_fl = df_fl[['人群名字', '人群分类']]
|
@@ -1012,12 +1018,22 @@ class GroupBy:
|
|
1012
1018
|
df['人群分类'].fillna('', inplace=True)
|
1013
1019
|
if '人群分类' in df.columns.tolist():
|
1014
1020
|
# 这行决定了,从文件中读取的分类信息优先级高于内部函数的分类规则
|
1021
|
+
# 这个 lambda 适配人群名字中带有特定标识的分类,强匹配
|
1015
1022
|
df['人群分类'] = df.apply(
|
1016
1023
|
lambda x: self.set_crowd(keyword=str(x['人群名字']), as_file=False) if x['人群分类'] == ''
|
1017
1024
|
else x['人群分类'], axis=1
|
1018
1025
|
)
|
1026
|
+
# 这个 lambda 适配人群名字中聚类的特征字符,弱匹配
|
1027
|
+
df['人群分类'] = df.apply(
|
1028
|
+
lambda x: self.set_crowd2(keyword=str(x['人群名字']), as_file=False) if x['人群分类'] == ''
|
1029
|
+
else x['人群分类'], axis=1
|
1030
|
+
)
|
1019
1031
|
else:
|
1020
1032
|
df['人群分类'] = df['人群名字'].apply(lambda x: self.set_crowd(keyword=str(x), as_file=False))
|
1033
|
+
df['人群分类'] = df.apply(
|
1034
|
+
lambda x: self.set_crowd2(keyword=str(x['人群名字']), as_file=False) if x['人群分类'] == ''
|
1035
|
+
else x['人群分类'], axis=1
|
1036
|
+
)
|
1021
1037
|
df['人群分类'] = df['人群分类'].apply(lambda x: str(x).upper() if x else x)
|
1022
1038
|
# df.to_csv('/Users/xigua/Downloads/test_人群分类.csv', index=False, header=True, encoding='utf-8_sig')
|
1023
1039
|
# breakpoint()
|
@@ -1071,7 +1087,7 @@ class GroupBy:
|
|
1071
1087
|
dir_file = dir_file2
|
1072
1088
|
if os.path.isfile(dir_file):
|
1073
1089
|
df_fl = pd.read_excel(dir_file, sheet_name='关键词分类', header=0)
|
1074
|
-
df_fl.rename(columns={'分类1': '词分类'}, inplace=True)
|
1090
|
+
# df_fl.rename(columns={'分类1': '词分类'}, inplace=True)
|
1075
1091
|
df_fl = df_fl[['关键词', '词分类']]
|
1076
1092
|
# 合并并获取词分类信息
|
1077
1093
|
df = pd.merge(df, df_fl, left_on=['词名字/词包名字'], right_on=['关键词'], how='left')
|
@@ -1678,6 +1694,103 @@ class GroupBy:
|
|
1678
1694
|
if not is_res:
|
1679
1695
|
return ''
|
1680
1696
|
|
1697
|
+
def set_crowd2(self, keyword, as_file=False):
|
1698
|
+
""" 推广人群报表,人群分类, """
|
1699
|
+
datas = [
|
1700
|
+
{
|
1701
|
+
'类别': 'A',
|
1702
|
+
'值': [
|
1703
|
+
'相似宝贝',
|
1704
|
+
'相似店铺',
|
1705
|
+
'类目',
|
1706
|
+
'88VIP',
|
1707
|
+
'拉新',
|
1708
|
+
'潮流',
|
1709
|
+
'会场',
|
1710
|
+
'意向',
|
1711
|
+
'>>', # 系统推荐的搜索相关人群
|
1712
|
+
'关键词:', # 系统推荐的搜索相关人群
|
1713
|
+
'关键词_', # 自建的搜索相关人群
|
1714
|
+
'扩展',
|
1715
|
+
'敏感人群',
|
1716
|
+
'尝鲜',
|
1717
|
+
'小二推荐',
|
1718
|
+
'竞争',
|
1719
|
+
'资深',
|
1720
|
+
'女王节',
|
1721
|
+
'本行业',
|
1722
|
+
'618',
|
1723
|
+
'包包树',
|
1724
|
+
'迪桑娜',
|
1725
|
+
'菲安妮',
|
1726
|
+
'卡思乐',
|
1727
|
+
'场景词',
|
1728
|
+
'竞对',
|
1729
|
+
'精选',
|
1730
|
+
'发现',
|
1731
|
+
'行业mvp'
|
1732
|
+
'特征继承',
|
1733
|
+
'机会',
|
1734
|
+
'推荐',
|
1735
|
+
'智能定向',
|
1736
|
+
]
|
1737
|
+
},
|
1738
|
+
{
|
1739
|
+
'类别': 'I',
|
1740
|
+
'值': [
|
1741
|
+
'行动',
|
1742
|
+
'收加',
|
1743
|
+
'收藏',
|
1744
|
+
'加购',
|
1745
|
+
'促首购',
|
1746
|
+
'店铺优惠券',
|
1747
|
+
'高转化',
|
1748
|
+
'认知',
|
1749
|
+
'喜欢我', # 系统推荐的宝贝相关人群
|
1750
|
+
'未购买',
|
1751
|
+
'种草',
|
1752
|
+
'兴趣',
|
1753
|
+
'本店',
|
1754
|
+
'领券',
|
1755
|
+
]
|
1756
|
+
},
|
1757
|
+
{
|
1758
|
+
'类别': 'P',
|
1759
|
+
'值': [
|
1760
|
+
'万里马',
|
1761
|
+
'购买',
|
1762
|
+
'已购',
|
1763
|
+
'促复购'
|
1764
|
+
'店铺会员',
|
1765
|
+
'店铺粉丝',
|
1766
|
+
'转化',
|
1767
|
+
]
|
1768
|
+
},
|
1769
|
+
{
|
1770
|
+
'类别': 'L',
|
1771
|
+
'值': [
|
1772
|
+
'L人群',
|
1773
|
+
]
|
1774
|
+
},
|
1775
|
+
]
|
1776
|
+
if as_file:
|
1777
|
+
with open(os.path.join(self.output, f'分类配置_推广人群分类_函数内置规则.json'), 'w') as f:
|
1778
|
+
json.dump(datas, f, ensure_ascii=False, sort_keys=False, indent=4)
|
1779
|
+
breakpoint()
|
1780
|
+
result = ''
|
1781
|
+
res = []
|
1782
|
+
is_continue = False
|
1783
|
+
for data in datas:
|
1784
|
+
for item in data['值']:
|
1785
|
+
res = re.findall(item, str(keyword), re.IGNORECASE)
|
1786
|
+
if res:
|
1787
|
+
result = data['类别']
|
1788
|
+
is_continue = True
|
1789
|
+
break
|
1790
|
+
if is_continue:
|
1791
|
+
break
|
1792
|
+
return result
|
1793
|
+
|
1681
1794
|
# @try_except
|
1682
1795
|
def performance(self, bb_tg=True):
|
1683
1796
|
# print(self.data_tgyj)
|
@@ -5,7 +5,7 @@ mdbq/aggregation/aggregation.py,sha256=nPp5fOLktxejNEak3SyTnKLjwzK1l2xjbV45X-I4L
|
|
5
5
|
mdbq/aggregation/df_types.py,sha256=U9i3q2eRPTDY8qAPTw7irzu-Tlg4CIySW9uYro81wdk,8125
|
6
6
|
mdbq/aggregation/mysql_types.py,sha256=DQYROALDiwjJzjhaJfIIdnsrNs11i5BORlj_v6bp67Y,11062
|
7
7
|
mdbq/aggregation/optimize_data.py,sha256=Wis40oL04M7E1pkvgNPjyVFAUe-zgjimjIVAikxYY8Y,4418
|
8
|
-
mdbq/aggregation/query_data.py,sha256=
|
8
|
+
mdbq/aggregation/query_data.py,sha256=mL9kGu1sZf0bIRI_s2PwF12tPR0z7jGkC_qWAz_5wG8,103128
|
9
9
|
mdbq/bdup/__init__.py,sha256=AkhsGk81SkG1c8FqDH5tRq-8MZmFobVbN60DTyukYTY,28
|
10
10
|
mdbq/bdup/bdup.py,sha256=LAV0TgnQpc-LB-YuJthxb0U42_VkPidzQzAagan46lU,4234
|
11
11
|
mdbq/clean/__init__.py,sha256=A1d6x3L27j4NtLgiFV5TANwEkLuaDfPHDQNrPBbNWtU,41
|
@@ -41,7 +41,7 @@ mdbq/req_post/__init__.py,sha256=jso1oHcy6cJEfa7udS_9uO5X6kZLoPBF8l3wCYmr5dM,18
|
|
41
41
|
mdbq/req_post/req_tb.py,sha256=PexWSCPJNM6Tv0ol4lAWIhlOwsAr_frnjtcdSHCFiek,36179
|
42
42
|
mdbq/spider/__init__.py,sha256=RBMFXGy_jd1HXZhngB2T2XTvJqki8P_Fr-pBcwijnew,18
|
43
43
|
mdbq/spider/aikucun.py,sha256=Olq7IJP9itM4wuNxZeHOG-Q3i8wWyB4hY8TUGGwCvQ0,14104
|
44
|
-
mdbq-2.4.
|
45
|
-
mdbq-2.4.
|
46
|
-
mdbq-2.4.
|
47
|
-
mdbq-2.4.
|
44
|
+
mdbq-2.4.8.dist-info/METADATA,sha256=1PkjCLlpg0ipzA5WgllXzHDYkMUb10_sMB0RU2xIIww,245
|
45
|
+
mdbq-2.4.8.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
46
|
+
mdbq-2.4.8.dist-info/top_level.txt,sha256=2FQ-uLnCSB-OwFiWntzmwosW3X2Xqsg0ewh1axsaylA,5
|
47
|
+
mdbq-2.4.8.dist-info/RECORD,,
|
File without changes
|
File without changes
|