mdbq 3.4.5__py3-none-any.whl → 3.4.7__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/datashow.py +11 -11
- mdbq/aggregation/query_data.py +12 -13
- mdbq/spider/aikucun.py +1 -1
- {mdbq-3.4.5.dist-info → mdbq-3.4.7.dist-info}/METADATA +1 -1
- {mdbq-3.4.5.dist-info → mdbq-3.4.7.dist-info}/RECORD +7 -7
- {mdbq-3.4.5.dist-info → mdbq-3.4.7.dist-info}/WHEEL +0 -0
- {mdbq-3.4.5.dist-info → mdbq-3.4.7.dist-info}/top_level.txt +0 -0
mdbq/aggregation/datashow.py
CHANGED
@@ -27,17 +27,23 @@ from matplotlib import rcParams
|
|
27
27
|
from sqlalchemy.sql.functions import count
|
28
28
|
|
29
29
|
if platform.system() == 'Windows':
|
30
|
+
ip_address = '192.168.1.117'
|
30
31
|
rcParams['font.sans-serif'] = ['SimHei'] # matplotlibrc 防止中文乱码
|
31
32
|
D_PATH = os.path.join(f'C:\\Users\\{getpass.getuser()}\\Downloads')
|
32
33
|
elif platform.system() == 'Linux':
|
34
|
+
ip_address = '127.0.0.1'
|
33
35
|
rcParams['font.sans-serif'] = ['Arial Unicode MS'] # matplotlibrc 防止中文乱码
|
34
36
|
D_PATH = 'Downloads'
|
35
37
|
if not os.path.exists(D_PATH):
|
36
38
|
os.makedirs(D_PATH)
|
37
39
|
else:
|
40
|
+
ip_address = '127.0.0.1'
|
38
41
|
rcParams['font.sans-serif'] = ['Arial Unicode MS'] # matplotlibrc 防止中文乱码
|
39
42
|
D_PATH = os.path.join(f'/Users/{getpass.getuser()}/Downloads')
|
40
43
|
|
44
|
+
PORT = 5050
|
45
|
+
DIRECTORY = os.path.join(D_PATH, 'http_server')
|
46
|
+
|
41
47
|
rcParams['axes.unicode_minus'] = False # 防止负号'-'被当作减号处理
|
42
48
|
m_engine = mysql.MysqlUpload(username='', password='', host='', port=0, charset='utf8mb4')
|
43
49
|
company_engine = mysql.MysqlUpload(username='', password='', host='', port=0, charset='utf8mb4')
|
@@ -979,12 +985,6 @@ class DataShow:
|
|
979
985
|
# 应用这个函数到图片列
|
980
986
|
df['Image_HTML'] = df['白底图'].apply(convert_image_to_html)
|
981
987
|
|
982
|
-
local_file1 = os.path.join(self.path, '多店推广场景.html')
|
983
|
-
local_file2 = os.path.join(self.path, '多店推广场景.html')
|
984
|
-
local_file3 = os.path.join(self.path, '多店推广场景.html')
|
985
|
-
local_file4 = os.path.join(self.path, '多店推广场景.html')
|
986
|
-
local_file5 = os.path.join(self.path, '多店推广场景.html')
|
987
|
-
|
988
988
|
# 创建 HTML
|
989
989
|
html_template = """
|
990
990
|
<!DOCTYPE html>
|
@@ -1198,11 +1198,11 @@ class DataShow:
|
|
1198
1198
|
|
1199
1199
|
final_html = html_template.replace('{rows}', ''.join(rows))
|
1200
1200
|
final_html = final_html.replace('统计周期', f'统计周期: {min_date} ~ {max_date}')
|
1201
|
-
final_html = final_html.replace('{local_file1}',
|
1202
|
-
final_html = final_html.replace('{local_file2}',
|
1203
|
-
final_html = final_html.replace('{local_file3}',
|
1204
|
-
final_html = final_html.replace('{local_file4}',
|
1205
|
-
final_html = final_html.replace('{local_file5}',
|
1201
|
+
final_html = final_html.replace('{local_file1}', '多店推广场景.html')
|
1202
|
+
final_html = final_html.replace('{local_file2}', '店铺流量来源.html')
|
1203
|
+
final_html = final_html.replace('{local_file3}', '达摩盘人群画像.html')
|
1204
|
+
final_html = final_html.replace('{local_file4}', '商品人群画像.html')
|
1205
|
+
final_html = final_html.replace('{local_file5}', '销售地域分布.html')
|
1206
1206
|
file = os.path.join(self.path, f'{filename}.html')
|
1207
1207
|
with open(file, 'w', encoding='utf-8') as f:
|
1208
1208
|
f.write(final_html)
|
mdbq/aggregation/query_data.py
CHANGED
@@ -154,6 +154,7 @@ class MysqlDatasQuery:
|
|
154
154
|
'直接成交笔数': 'int64',
|
155
155
|
'直接成交金额': 'float64',
|
156
156
|
}, errors='raise')
|
157
|
+
df = df[df['花费'] > 0]
|
157
158
|
if is_maximize:
|
158
159
|
df = df.groupby(['日期', '店铺名称', '营销场景', '商品id', '花费', '点击量'], as_index=False).agg(
|
159
160
|
**{
|
@@ -840,6 +841,7 @@ class MysqlDatasQuery:
|
|
840
841
|
'粉丝关注量': 'int64',
|
841
842
|
'观看次数': 'int64',
|
842
843
|
}, errors='raise')
|
844
|
+
df = df[df['花费'] > 0]
|
843
845
|
if is_maximize:
|
844
846
|
df = df.groupby(['日期', '店铺名称', '营销场景', '人群名字', '计划名字', '花费', '观看次数'],
|
845
847
|
as_index=False).agg(
|
@@ -3360,6 +3362,7 @@ class MysqlDatasQuery:
|
|
3360
3362
|
df.drop(labels='宝贝id', axis=1, inplace=True)
|
3361
3363
|
|
3362
3364
|
df['商品id'] = df['商品id'].astype('int64')
|
3365
|
+
df = df[df['花费'] > 0]
|
3363
3366
|
df = df.groupby(
|
3364
3367
|
['日期', '店铺名称', '商品id'],
|
3365
3368
|
as_index=False).agg(
|
@@ -3578,7 +3581,7 @@ class MysqlDatasQuery:
|
|
3578
3581
|
jdtg = [item['数据主体'] for item in self.pf_datas_jd if item['集合名称'] == '京东_京准通'][0]
|
3579
3582
|
sku_sales = [item['数据主体'] for item in self.pf_datas_jd if item['集合名称'] == '京东_sku_商品明细'][0]
|
3580
3583
|
cost = [item['数据主体'] for item in self.pf_datas if item['集合名称'] == '商品成本'][0]
|
3581
|
-
|
3584
|
+
jdtg = jdtg[jdtg['花费'] > 0]
|
3582
3585
|
jdtg = jdtg.groupby(['日期', '跟单sku_id'],
|
3583
3586
|
as_index=False).agg(
|
3584
3587
|
**{
|
@@ -3887,10 +3890,10 @@ def main(days=150, months=3):
|
|
3887
3890
|
|
3888
3891
|
|
3889
3892
|
if __name__ == '__main__':
|
3890
|
-
|
3891
|
-
|
3892
|
-
|
3893
|
-
|
3893
|
+
main(
|
3894
|
+
days=3, # 清理聚合数据的日期长度
|
3895
|
+
months=2 # 生成聚合数据的长度
|
3896
|
+
)
|
3894
3897
|
|
3895
3898
|
# query_list = [query1, query2]
|
3896
3899
|
# # 使用 ThreadPoolExecutor 来并行运行
|
@@ -3914,11 +3917,7 @@ if __name__ == '__main__':
|
|
3914
3917
|
|
3915
3918
|
# query3(months=2, less_dict=[])
|
3916
3919
|
|
3917
|
-
sdq = MysqlDatasQuery() # 实例化数据处理类
|
3918
|
-
sdq.months = 1 # 设置数据周期, 1 表示近 2 个月
|
3919
|
-
sdq.update_service = True # 调试时加,true: 将数据写入 mysql 服务器
|
3920
|
-
sdq.item_up()
|
3921
|
-
|
3922
|
-
# string = '30-34岁,35-39岁,40-49岁'
|
3923
|
-
# d = "~".join(re.findall(r'(\d+)\D.*\D(\d+)岁', string)[0])
|
3924
|
-
# print(d)
|
3920
|
+
# sdq = MysqlDatasQuery() # 实例化数据处理类
|
3921
|
+
# sdq.months = 1 # 设置数据周期, 1 表示近 2 个月
|
3922
|
+
# sdq.update_service = True # 调试时加,true: 将数据写入 mysql 服务器
|
3923
|
+
# sdq.item_up()
|
mdbq/spider/aikucun.py
CHANGED
@@ -2,9 +2,9 @@ mdbq/__init__.py,sha256=Il5Q9ATdX8yXqVxtP_nYqUhExzxPC_qk_WXQ_4h0exg,16
|
|
2
2
|
mdbq/__version__.py,sha256=y9Mp_8x0BCZSHsdLT_q5tX9wZwd5QgqrSIENLrb6vXA,62
|
3
3
|
mdbq/aggregation/__init__.py,sha256=EeDqX2Aml6SPx8363J-v1lz0EcZtgwIBYyCJV6CcEDU,40
|
4
4
|
mdbq/aggregation/aggregation.py,sha256=-yzApnlqSN2L0E1YMu5ml-W827qpKQvWPCOI7jj2kzY,80264
|
5
|
-
mdbq/aggregation/datashow.py,sha256=
|
5
|
+
mdbq/aggregation/datashow.py,sha256=1AYSIDkdUx-4as1Ax2rPj0cExM9d-qFMrFYLAaPHNuk,54962
|
6
6
|
mdbq/aggregation/optimize_data.py,sha256=RXIv7cACCgYyehAxMjUYi_S7rVyjIwXKWMaM3nduGtA,3068
|
7
|
-
mdbq/aggregation/query_data.py,sha256=
|
7
|
+
mdbq/aggregation/query_data.py,sha256=Hen76ZLzBesW2snPnhbuUuhTQBkp2kyoekXnBzzeJI4,178903
|
8
8
|
mdbq/bdup/__init__.py,sha256=AkhsGk81SkG1c8FqDH5tRq-8MZmFobVbN60DTyukYTY,28
|
9
9
|
mdbq/bdup/bdup.py,sha256=LAV0TgnQpc-LB-YuJthxb0U42_VkPidzQzAagan46lU,4234
|
10
10
|
mdbq/config/__init__.py,sha256=jso1oHcy6cJEfa7udS_9uO5X6kZLoPBF8l3wCYmr5dM,18
|
@@ -33,8 +33,8 @@ mdbq/pbix/pbix_refresh.py,sha256=JUjKW3bNEyoMVfVfo77UhguvS5AWkixvVhDbw4_MHco,239
|
|
33
33
|
mdbq/pbix/refresh_all.py,sha256=OBT9EewSZ0aRS9vL_FflVn74d4l2G00wzHiikCC4TC0,5926
|
34
34
|
mdbq/pbix/refresh_all_old.py,sha256=_pq3WSQ728GPtEG5pfsZI2uTJhU8D6ra-htIk1JXYzw,7192
|
35
35
|
mdbq/spider/__init__.py,sha256=RBMFXGy_jd1HXZhngB2T2XTvJqki8P_Fr-pBcwijnew,18
|
36
|
-
mdbq/spider/aikucun.py,sha256=
|
37
|
-
mdbq-3.4.
|
38
|
-
mdbq-3.4.
|
39
|
-
mdbq-3.4.
|
40
|
-
mdbq-3.4.
|
36
|
+
mdbq/spider/aikucun.py,sha256=zOacjrJ3MvToyuugA68xB-oN6RKj8K3GxMKudnln9EA,22207
|
37
|
+
mdbq-3.4.7.dist-info/METADATA,sha256=XuS97AgY84g8aezQcwsMDhiW86WRqrRufN1SnZSFgT4,243
|
38
|
+
mdbq-3.4.7.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
39
|
+
mdbq-3.4.7.dist-info/top_level.txt,sha256=2FQ-uLnCSB-OwFiWntzmwosW3X2Xqsg0ewh1axsaylA,5
|
40
|
+
mdbq-3.4.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|