mdbq 1.4.8__tar.gz → 1.4.9__tar.gz

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.
Files changed (45) hide show
  1. {mdbq-1.4.8 → mdbq-1.4.9}/PKG-INFO +1 -1
  2. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/aggregation/query_data.py +60 -3
  3. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq.egg-info/PKG-INFO +1 -1
  4. {mdbq-1.4.8 → mdbq-1.4.9}/setup.py +1 -1
  5. {mdbq-1.4.8 → mdbq-1.4.9}/README.txt +0 -0
  6. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/__init__.py +0 -0
  7. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/__version__.py +0 -0
  8. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/aggregation/__init__.py +0 -0
  9. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/aggregation/aggregation.py +0 -0
  10. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/aggregation/df_types.py +0 -0
  11. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/aggregation/mysql_types.py +0 -0
  12. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/aggregation/optimize_data.py +0 -0
  13. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/bdup/__init__.py +0 -0
  14. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/bdup/bdup.py +0 -0
  15. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/clean/__init__.py +0 -0
  16. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/clean/data_clean.py +0 -0
  17. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/company/__init__.py +0 -0
  18. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/company/copysh.py +0 -0
  19. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/config/__init__.py +0 -0
  20. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/config/get_myconf.py +0 -0
  21. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/config/products.py +0 -0
  22. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/config/set_support.py +0 -0
  23. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/config/update_conf.py +0 -0
  24. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/dataframe/__init__.py +0 -0
  25. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/dataframe/converter.py +0 -0
  26. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/log/__init__.py +0 -0
  27. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/log/mylogger.py +0 -0
  28. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/mongo/__init__.py +0 -0
  29. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/mongo/mongo.py +0 -0
  30. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/mysql/__init__.py +0 -0
  31. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/mysql/mysql.py +0 -0
  32. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/mysql/s_query.py +0 -0
  33. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/mysql/year_month_day.py +0 -0
  34. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/other/__init__.py +0 -0
  35. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/other/porxy.py +0 -0
  36. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/other/pov_city.py +0 -0
  37. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/other/ua_sj.py +0 -0
  38. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/pbix/__init__.py +0 -0
  39. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/pbix/pbix_refresh.py +0 -0
  40. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/pbix/refresh_all.py +0 -0
  41. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq/spider/__init__.py +0 -0
  42. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq.egg-info/SOURCES.txt +0 -0
  43. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq.egg-info/dependency_links.txt +0 -0
  44. {mdbq-1.4.8 → mdbq-1.4.9}/mdbq.egg-info/top_level.txt +0 -0
  45. {mdbq-1.4.8 → mdbq-1.4.9}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mdbq
3
- Version: 1.4.8
3
+ Version: 1.4.9
4
4
  Home-page: https://pypi.org/project/mdbsql
5
5
  Author: xigua,
6
6
  Author-email: 2587125111@qq.com
@@ -349,9 +349,60 @@ class GroupBy:
349
349
  }
350
350
  )
351
351
  return df
352
- elif '店铺来源_日数据' in table_name:
352
+ elif '店铺来源_日数据' in table_name and '旧版' not in table_name:
353
+ # 包含三级来源名称和预设索引值列
354
+ # 截取 从上月1日 至 今天的花费数据, 推广款式按此数据从高到低排序(商品图+排序)
355
+ df_visitor3 = df.groupby(['日期', '三级来源'], as_index=False).agg({'访客数': 'sum'})
356
+ df_visitor3 = df_visitor3[~df_visitor3['三级来源'].isin([''])] # 指定列中删除包含空值的行
357
+ # df_visitor = df_visitor[(df_visitor['日期'] >= f'{year_my}-{last_month.month}-01')]
358
+ df_visitor3 = df_visitor3.groupby(['三级来源'], as_index=False).agg({'访客数': 'sum'})
359
+ df_visitor3.sort_values('访客数', ascending=False, ignore_index=True, inplace=True)
360
+ df_visitor3.reset_index(inplace=True)
361
+ df_visitor3['index'] = df_visitor3['index'] + 100
362
+ df_visitor3.rename(columns={'index': '三级访客索引'}, inplace=True)
363
+ df_visitor3 = df_visitor3[['三级来源', '三级访客索引']]
364
+
365
+ # 包含二级来源名称和预设索引值列
366
+ df_visitor2 = df.groupby(['日期', '二级来源'], as_index=False).agg({'访客数': 'sum'})
367
+ df_visitor2 = df_visitor2[~df_visitor2['二级来源'].isin([''])] # 指定列中删除包含空值的行
368
+ # df_visitor2 = df_visitor2[(df_visitor2['日期'] >= f'{year_my}-{last_month.month}-01')]
369
+ df_visitor2 = df_visitor2.groupby(['二级来源'], as_index=False).agg({'访客数': 'sum'})
370
+ df_visitor2.sort_values('访客数', ascending=False, ignore_index=True, inplace=True)
371
+ df_visitor2.reset_index(inplace=True)
372
+ df_visitor2['index'] = df_visitor2['index'] + 100
373
+ df_visitor2.rename(columns={'index': '二级访客索引'}, inplace=True)
374
+ df_visitor2 = df_visitor2[['二级来源', '二级访客索引']]
375
+
376
+ df = pd.merge(df, df_visitor2, how='left', left_on='二级来源', right_on='二级来源')
377
+ df = pd.merge(df, df_visitor3, how='left', left_on='三级来源', right_on='三级来源')
353
378
  return df
354
- elif '店铺来源_日数据_旧版' in table_name:
379
+ elif '天猫_店铺来源_日数据_旧版' in table_name:
380
+
381
+ # 包含三级来源名称和预设索引值列
382
+ # 截取 从上月1日 至 今天的花费数据, 推广款式按此数据从高到低排序(商品图+排序)
383
+ df_visitor3 = df.groupby(['日期', '三级来源'], as_index=False).agg({'访客数': 'sum'})
384
+ df_visitor3 = df_visitor3[~df_visitor3['三级来源'].isin([''])] # 指定列中删除包含空值的行
385
+ # df_visitor = df_visitor[(df_visitor['日期'] >= f'{year_my}-{last_month.month}-01')]
386
+ df_visitor3 = df_visitor3.groupby(['三级来源'], as_index=False).agg({'访客数': 'sum'})
387
+ df_visitor3.sort_values('访客数', ascending=False, ignore_index=True, inplace=True)
388
+ df_visitor3.reset_index(inplace=True)
389
+ df_visitor3['index'] = df_visitor3['index'] + 100
390
+ df_visitor3.rename(columns={'index': '三级访客索引'}, inplace=True)
391
+ df_visitor3 = df_visitor3[['三级来源', '三级访客索引']]
392
+
393
+ # 包含二级来源名称和预设索引值列
394
+ df_visitor2 = df.groupby(['日期', '二级来源'], as_index=False).agg({'访客数': 'sum'})
395
+ df_visitor2 = df_visitor2[~df_visitor2['二级来源'].isin([''])] # 指定列中删除包含空值的行
396
+ # df_visitor2 = df_visitor2[(df_visitor2['日期'] >= f'{year_my}-{last_month.month}-01')]
397
+ df_visitor2 = df_visitor2.groupby(['二级来源'], as_index=False).agg({'访客数': 'sum'})
398
+ df_visitor2.sort_values('访客数', ascending=False, ignore_index=True, inplace=True)
399
+ df_visitor2.reset_index(inplace=True)
400
+ df_visitor2['index'] = df_visitor2['index'] + 100
401
+ df_visitor2.rename(columns={'index': '二级访客索引'}, inplace=True)
402
+ df_visitor2 = df_visitor2[['二级来源', '二级访客索引']]
403
+
404
+ df = pd.merge(df, df_visitor2, how='left', left_on='二级来源', right_on='二级来源')
405
+ df = pd.merge(df, df_visitor3, how='left', left_on='三级来源', right_on='三级来源')
355
406
  return df
356
407
  elif '商品id编码表' in table_name:
357
408
  df['宝贝id'] = df['宝贝id'].astype(str)
@@ -542,6 +593,12 @@ def data_aggregation_one(service_databases=[{}], months=1, system_name=None,):
542
593
  # 从数据库中获取数据, 返回包含 df 数据的字典
543
594
  # 单独处理某一个聚合数据库,在这里修改添加 data_dict 的值
544
595
  data_dict = [
596
+ {
597
+ '数据库名': '聚合数据',
598
+ '集合名': '天猫_店铺来源_日数据_旧版',
599
+ '唯一主键': ['日期', '一级来源', '二级来源', '三级来源'],
600
+ '数据主体': sdq.dplyd_old(),
601
+ },
545
602
  {
546
603
  '数据库名': '聚合数据',
547
604
  '集合名': '天猫_店铺来源_日数据',
@@ -665,5 +722,5 @@ def data_aggregation(service_databases=[{}], months=1, system_name=None,):
665
722
 
666
723
  if __name__ == '__main__':
667
724
  # data_aggregation(service_databases=[{'home_lx': 'mysql'}], months=1, system_name='home_lx')
668
- data_aggregation_one(service_databases=[{'company': 'mysql'}], months=10, system_name='company')
725
+ data_aggregation_one(service_databases=[{'company': 'mysql'}], months=12, system_name='company')
669
726
  # optimize_data.op_data(service_databases=[{'company': 'mysql'}], days=3650) # 立即启动对聚合数据的清理工作
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mdbq
3
- Version: 1.4.8
3
+ Version: 1.4.9
4
4
  Home-page: https://pypi.org/project/mdbsql
5
5
  Author: xigua,
6
6
  Author-email: 2587125111@qq.com
@@ -3,7 +3,7 @@
3
3
  from setuptools import setup, find_packages
4
4
 
5
5
  setup(name='mdbq',
6
- version='1.4.8',
6
+ version='1.4.9',
7
7
  author='xigua, ',
8
8
  author_email="2587125111@qq.com",
9
9
  url='https://pypi.org/project/mdbsql',
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes