mdbq 1.7.8__py3-none-any.whl → 1.7.9__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.
@@ -431,6 +431,28 @@ class MysqlDatasQuery:
431
431
  start_date = f'{start_date.year}-{start_date.month}-01' # 替换为 n 月以前的第一天
432
432
  return pd.to_datetime(start_date), pd.to_datetime(end_date)
433
433
 
434
+ def tm_search(self):
435
+ start_date, end_date = self.months_data(num=self.months)
436
+ projection = {
437
+ '日期': 1,
438
+ '关键词': 1,
439
+ '访客数': 1,
440
+ '支付转化率': 1,
441
+ '支付金额': 1,
442
+ '下单金额': 1,
443
+ '支付买家数': 1,
444
+ '下单买家数': 1,
445
+ '加购人数': 1,
446
+ '新访客': 1,
447
+ }
448
+ df = self.download.data_to_df(
449
+ db_name='生意参谋2',
450
+ table_name='店铺来源_手淘搜索',
451
+ start_date=start_date,
452
+ end_date=end_date,
453
+ projection=projection,
454
+ )
455
+ return df
434
456
 
435
457
  class GroupBy:
436
458
  """
@@ -978,6 +1000,22 @@ class GroupBy:
978
1000
  df['s_是否品牌词'] = df['搜索词'].str.contains('万里马|wanlima', regex=True)
979
1001
  df['s_是否品牌词'] = df['s_是否品牌词'].apply(lambda x: '品牌词' if x else '')
980
1002
  return df
1003
+ elif '天猫店铺来源_手淘搜索' in table_name:
1004
+ df = df.groupby(
1005
+ ['日期', '关键词'],
1006
+ as_index=False).agg(
1007
+ **{
1008
+ '访客数': ('访客数', np.max),
1009
+ '支付转化率': ('支付转化率', np.max),
1010
+ '支付金额': ('支付金额', np.max),
1011
+ '下单金额': ('下单金额', np.max),
1012
+ '支付买家数': ('支付买家数', np.max),
1013
+ '下单买家数': ('下单买家数', np.max),
1014
+ '加购人数': ('加购人数', np.max),
1015
+ '新访客': ('新访客', np.max),
1016
+ }
1017
+ )
1018
+ return df
981
1019
  else:
982
1020
  print(f'<{table_name}>: Groupby 类尚未配置,数据为空')
983
1021
  return pd.DataFrame({})
@@ -1340,6 +1378,12 @@ def data_aggregation(service_databases=[{}], months=1):
1340
1378
  '唯一主键': ['日期', '报表类型', '推广渠道', '营销场景', '花费'],
1341
1379
  '数据主体': sdq.pxb_zh(),
1342
1380
  },
1381
+ {
1382
+ '数据库名': '聚合数据',
1383
+ '集合名': '天猫店铺来源_手淘搜索',
1384
+ '唯一主键': ['日期', '关键词', '访客数'],
1385
+ '数据主体': sdq.tm_search(),
1386
+ },
1343
1387
  ]
1344
1388
  for items in data_dict: # 遍历返回结果
1345
1389
  db_name, table_name, unique_key_list, df = items['数据库名'], items['集合名'], items['唯一主键'], items['数据主体']
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mdbq
3
- Version: 1.7.8
3
+ Version: 1.7.9
4
4
  Home-page: https://pypi.org/project/mdbsql
5
5
  Author: xigua,
6
6
  Author-email: 2587125111@qq.com
@@ -5,7 +5,7 @@ mdbq/aggregation/aggregation.py,sha256=sgsetJHK4fOcXvqQCVgJoSIwZQLMznVG3I-MqHlW_
5
5
  mdbq/aggregation/df_types.py,sha256=oQJS2IBU3_IO6GMgbssHuC2yCjNnbta0QPGrFOwNLnU,7591
6
6
  mdbq/aggregation/mysql_types.py,sha256=DQYROALDiwjJzjhaJfIIdnsrNs11i5BORlj_v6bp67Y,11062
7
7
  mdbq/aggregation/optimize_data.py,sha256=u2Kl_MFtZueXJ57ycy4H2OhXD431RctUYJYCl637uT0,4176
8
- mdbq/aggregation/query_data.py,sha256=9UhWwFAhMieC5iOIna_sAhsk2WvSpzGd5aDvkRo_pVE,68486
8
+ mdbq/aggregation/query_data.py,sha256=dzS1XvoJ0oEckrvIF-_uUALnPIRG4mOwG5ktr3LWsKY,70243
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
@@ -35,7 +35,7 @@ mdbq/pbix/__init__.py,sha256=Trtfaynu9RjoTyLLYBN2xdRxTvm_zhCniUkVTAYwcjo,24
35
35
  mdbq/pbix/pbix_refresh.py,sha256=JUjKW3bNEyoMVfVfo77UhguvS5AWkixvVhDbw4_MHco,2396
36
36
  mdbq/pbix/refresh_all.py,sha256=sBZ61LKvm-raa9ROnC-AAvPYLU7dbudmuxy__5QCB2A,7176
37
37
  mdbq/spider/__init__.py,sha256=RBMFXGy_jd1HXZhngB2T2XTvJqki8P_Fr-pBcwijnew,18
38
- mdbq-1.7.8.dist-info/METADATA,sha256=GSjzapW9LjD8Jco2uKTvfb6Ex9lWJW1Eo33BpvXLUls,245
39
- mdbq-1.7.8.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
40
- mdbq-1.7.8.dist-info/top_level.txt,sha256=2FQ-uLnCSB-OwFiWntzmwosW3X2Xqsg0ewh1axsaylA,5
41
- mdbq-1.7.8.dist-info/RECORD,,
38
+ mdbq-1.7.9.dist-info/METADATA,sha256=UsQE_0nklf8Vqmz_cQsepvi79ifPTWx9WhNsN6PWJOc,245
39
+ mdbq-1.7.9.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
40
+ mdbq-1.7.9.dist-info/top_level.txt,sha256=2FQ-uLnCSB-OwFiWntzmwosW3X2Xqsg0ewh1axsaylA,5
41
+ mdbq-1.7.9.dist-info/RECORD,,
File without changes