mdbq 2.7.2__tar.gz → 2.7.4__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 (55) hide show
  1. {mdbq-2.7.2 → mdbq-2.7.4}/PKG-INFO +1 -1
  2. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/aggregation/aggregation.py +23 -12
  3. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/aggregation/optimize_data.py +3 -2
  4. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/aggregation/query_data.py +2 -2
  5. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/clean/clean_upload.py +10 -14
  6. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/config/products.py +2 -1
  7. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq.egg-info/PKG-INFO +1 -1
  8. {mdbq-2.7.2 → mdbq-2.7.4}/setup.py +1 -1
  9. {mdbq-2.7.2 → mdbq-2.7.4}/README.txt +0 -0
  10. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/__init__.py +0 -0
  11. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/__version__.py +0 -0
  12. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/aggregation/__init__.py +0 -0
  13. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/aggregation/df_types.py +0 -0
  14. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/aggregation/mysql_types.py +0 -0
  15. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/bdup/__init__.py +0 -0
  16. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/bdup/bdup.py +0 -0
  17. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/clean/__init__.py +0 -0
  18. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/clean/data_clean.py +0 -0
  19. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/company/__init__.py +0 -0
  20. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/company/copysh.py +0 -0
  21. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/company/copysh_bak.py +0 -0
  22. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/company/home_sh.py +0 -0
  23. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/config/__init__.py +0 -0
  24. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/config/get_myconf.py +0 -0
  25. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/config/myconfig.py +0 -0
  26. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/config/set_support.py +0 -0
  27. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/config/update_conf.py +0 -0
  28. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/dataframe/__init__.py +0 -0
  29. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/dataframe/converter.py +0 -0
  30. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/log/__init__.py +0 -0
  31. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/log/mylogger.py +0 -0
  32. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/mongo/__init__.py +0 -0
  33. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/mongo/mongo.py +0 -0
  34. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/mysql/__init__.py +0 -0
  35. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/mysql/mysql.py +0 -0
  36. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/mysql/recheck_mysql.py +0 -0
  37. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/mysql/s_query.py +0 -0
  38. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/mysql/year_month_day.py +0 -0
  39. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/other/__init__.py +0 -0
  40. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/other/porxy.py +0 -0
  41. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/other/pov_city.py +0 -0
  42. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/other/sku_picture.py +0 -0
  43. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/other/ua_sj.py +0 -0
  44. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/pbix/__init__.py +0 -0
  45. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/pbix/pbix_refresh.py +0 -0
  46. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/pbix/refresh_all.py +0 -0
  47. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/pbix/refresh_all_old.py +0 -0
  48. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/req_post/__init__.py +0 -0
  49. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/req_post/req_tb.py +0 -0
  50. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/spider/__init__.py +0 -0
  51. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq/spider/aikucun.py +0 -0
  52. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq.egg-info/SOURCES.txt +0 -0
  53. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq.egg-info/dependency_links.txt +0 -0
  54. {mdbq-2.7.2 → mdbq-2.7.4}/mdbq.egg-info/top_level.txt +0 -0
  55. {mdbq-2.7.2 → mdbq-2.7.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mdbq
3
- Version: 2.7.2
3
+ Version: 2.7.4
4
4
  Home-page: https://pypi.org/project/mdbq
5
5
  Author: xigua,
6
6
  Author-email: 2587125111@qq.com
@@ -1290,24 +1290,35 @@ def file_dir(one_file=True, target_service='company'):
1290
1290
 
1291
1291
 
1292
1292
  def test():
1293
- path = os.path.relpath(r'C:\同步空间\BaiduSyncdisk\原始文件3\京东报表\京准通_全sdfsdf站营销')
1293
+ path = os.path.relpath(r'/Users/xigua/数据中心/原始文件3/达摩盘/dmp人群报表')
1294
1294
  for root, dirs, files in os.walk(path, topdown=False):
1295
1295
  for name in files:
1296
1296
  if name.endswith('.csv') and 'baidu' not in name and '~' not in name:
1297
1297
  # print(name)
1298
1298
  # df = pd.read_excel(os.path.join(root, name), header=0)
1299
1299
  df = pd.read_csv(os.path.join(root, name), encoding='utf-8_sig', header=0, na_filter=False)
1300
- print(name, len(df))
1300
+ print(name)
1301
1301
  if len(df) == 0:
1302
1302
  print(name)
1303
1303
  os.remove(os.path.join(root, name))
1304
1304
  continue
1305
- cols = df.columns.tolist()
1306
- if '店铺名称' not in cols:
1307
- df.insert(loc=1, column='店铺名称', value='京东箱包旗舰店')
1308
- if '全站roi' in cols:
1309
- df.rename(columns={'全站roi': '全站投产比'}, inplace=True)
1305
+ df = df[df['日期'] != '']
1306
+ # cols = df.columns.tolist()
1307
+ # if '千次展现花费' not in cols:
1308
+ # df.insert(loc=14, column='千次展现花费', value=0.0)
1309
+ # df.rename(columns={'总费用': '花费', '直接购物车数': '直接加购数', '总购物车数': '总加购数'}, inplace=True)
1310
+ # if '类目ID' not in cols:
1311
+ # df['类目ID'] = 'null'
1312
+ # if '类目名称' not in cols:
1313
+ # df['类目名称'] = 'null'
1314
+ # if '店铺名称' not in cols:
1315
+ # df.insert(loc=1, column='店铺名称', value='京东箱包旗舰店')
1316
+ # if '全站roi' in cols:
1317
+ # df.rename(columns={'全站roi': '全站投产比'}, inplace=True)
1318
+ # new_name = f'{os.path.splitext(name)[0]}.csv'
1310
1319
  df.to_csv(os.path.join(root, name), encoding='utf-8_sig', index=False, header=True)
1320
+ # breakpoint()
1321
+ # os.remove(os.path.join(root, name))
1311
1322
  # new_name = f'{os.path.splitext(name)[0]}.xlsx'
1312
1323
  # df.to_excel(os.path.join(root, name),
1313
1324
  # index=False, header=True, engine='openpyxl', freeze_panes=(1, 0))
@@ -1328,16 +1339,16 @@ if __name__ == '__main__':
1328
1339
  # target_service='home_lx',
1329
1340
  # database='mysql'
1330
1341
  # )
1331
-
1342
+ #
1332
1343
  # 上传一个目录到指定数据库
1333
- db_name = '推广数据2'
1334
- table_name = '品销宝'
1344
+ db_name = '京东数据3'
1345
+ table_name = '京东商智_店铺来源'
1335
1346
  upload_dir(
1336
- path=os.path.relpath(r'C:\同步空间\BaiduSyncdisk\原始文件3\天猫推广报表\品销宝'),
1347
+ path=os.path.relpath(r'/Users/xigua/数据中心/原始文件3/京东报表/店铺来源_三级来asdasdas源'),
1337
1348
  db_name=db_name,
1338
1349
  collection_name=table_name,
1339
1350
  dbs={'mysql': True, 'mongodb': False},
1340
- target_service='home_lx',
1351
+ target_service='company',
1341
1352
  )
1342
1353
 
1343
1354
  # test()
@@ -10,12 +10,13 @@ import platform
10
10
  """
11
11
  对指定数据库所有冗余数据进行清理
12
12
  """
13
+ username, password, host, port, service_database = None, None, None, None, None,
13
14
  if socket.gethostname().lower() in ['xigua_lx', 'xigua1', 'macbook pro']:
14
15
  conf = myconfig.main()
15
16
  data = conf['Windows']['xigua_lx']['mysql']['local']
16
17
  username, password, host, port = data['username'], data['password'], data['host'], data['port']
17
18
  service_database = {'xigua_lx': 'mysql'}
18
- elif socket.gethostname().lower() in ['company', 'Mac2.local']:
19
+ elif socket.gethostname().lower() in ['company', 'mac2.local']:
19
20
  conf = myconfig.main()
20
21
  data = conf['Windows']['company']['mysql']['local']
21
22
  username, password, host, port = data['username'], data['password'], data['host'], data['port']
@@ -73,7 +74,7 @@ def restart_mongodb():
73
74
  def op_data(db_name_lists, days: int = 63, is_mongo=True, is_mysql=True):
74
75
  """ """
75
76
 
76
- if socket.gethostname() == 'xigua_lx' or socket.gethostname() == 'xigua1' or socket.gethostname() == 'Mac2.local':
77
+ if socket.gethostname() == 'xigua_lx' or socket.gethostname() == 'xigua1' or socket.gethostname() == 'mac2.local':
77
78
  # Mysql
78
79
  if is_mysql:
79
80
  s = mysql.OptimizeDatas(username=username, password=password, host=host, port=port)
@@ -25,13 +25,13 @@ import os
25
25
  3. 在 data_aggregation 类中添加 data_dict 字典键值,回传数据到数据库
26
26
 
27
27
  """
28
-
28
+ username, password, host, port, service_database = None, None, None, None, None,
29
29
  if socket.gethostname().lower() in ['xigua_lx', 'xigua1', 'macbook pro']:
30
30
  conf = myconfig.main()
31
31
  conf_data = conf['Windows']['xigua_lx']['mysql']['local']
32
32
  username, password, host, port = conf_data['username'], conf_data['password'], conf_data['host'], conf_data['port']
33
33
  service_database = {'xigua_lx': 'mysql'}
34
- elif socket.gethostname().lower() in ['company', 'Mac2.local']:
34
+ elif socket.gethostname().lower() in ['company', 'mac2.local']:
35
35
  conf = myconfig.main()
36
36
  conf_data = conf['Windows']['company']['mysql']['local']
37
37
  username, password, host, port = conf_data['username'], conf_data['password'], conf_data['host'], conf_data['port']
@@ -45,12 +45,13 @@ upload_path = os.path.join(D_PATH, '数据上传中心') # 此目录位于下
45
45
  # source_path = os.path.join(Data_Path, '原始文件2') # 此目录保存下载并清洗过的文件,作为数据库备份
46
46
  source_path3 = os.path.join(Data_Path, '原始文件3') # 此目录保存下载并清洗过的文件,作为数据库备份
47
47
 
48
+ username, password, host, port, service_database = None, None, None, None, None,
48
49
  if socket.gethostname().lower() in ['xigua_lx', 'xigua1', 'macbook pro']:
49
50
  conf = myconfig.main()
50
51
  conf_data = conf['Windows']['xigua_lx']['mysql']['local']
51
52
  username, password, host, port = conf_data['username'], conf_data['password'], conf_data['host'], conf_data['port']
52
53
  service_database = {'xigua_lx': 'mysql'}
53
- elif socket.gethostname().lower() in ['company', 'Mac2.local']:
54
+ elif socket.gethostname().lower() in ['company', 'mac2.local']:
54
55
  conf = myconfig.main()
55
56
  conf_data = conf['Windows']['company']['mysql']['local']
56
57
  username, password, host, port = conf_data['username'], conf_data['password'], conf_data['host'], conf_data['port']
@@ -278,6 +279,7 @@ class DataClean:
278
279
  os.remove(os.path.join(root, name))
279
280
  elif name.endswith('.csv') and 'dmp人群报表_' in name:
280
281
  df = pd.read_csv(os.path.join(root, name), encoding='utf-8_sig', header=0, na_filter=False)
282
+ df = df[df['日期'] != '']
281
283
  if len(df) == 0:
282
284
  print(f'{name} 报表数据为空')
283
285
  os.remove(os.path.join(root, name))
@@ -1140,22 +1142,22 @@ class DataClean:
1140
1142
  if 'py_xg' not in name: # 排除非目标文件
1141
1143
  continue
1142
1144
 
1143
- if name.endswith('.xlsx') and '京东商智_spu_商品明细' in name:
1145
+ if name.endswith('.csv') and '京东商智_spu_商品明细' in name:
1144
1146
  t_path = os.path.join(self.source_path, '京东报表', '京东商智_spu_商品明细')
1145
1147
  bib(t_path, _as_month=True)
1146
- elif name.endswith('.xlsx') and '京东商智_sku_商品明细' in name:
1148
+ elif name.endswith('.csv') and '京东商智_sku_商品明细' in name:
1147
1149
  t_path = os.path.join(self.source_path, '京东报表', '京东商智_sku_商品明细')
1148
1150
  bib(t_path, _as_month=True)
1149
- elif name.endswith('.xlsx') and '京东推广_搜索词' in name:
1151
+ elif name.endswith('.csv') and '京东推广_搜索词' in name:
1150
1152
  t_path = os.path.join(self.source_path, '京东报表', '搜索词报表')
1151
1153
  bib(t_path, _as_month=True)
1152
- elif name.endswith('.xlsx') and '京东推广_点击成交' in name:
1154
+ elif name.endswith('.csv') and '京东推广_点击成交' in name:
1153
1155
  t_path = os.path.join(self.source_path, '京东报表', '推广报表')
1154
1156
  bib(t_path, _as_month=True)
1155
- elif name.endswith('.xlsx') and '京东推广_关键词点击' in name:
1157
+ elif name.endswith('.csv') and '京东推广_关键词点击' in name:
1156
1158
  t_path = os.path.join(self.source_path, '京东报表', '关键词报表')
1157
1159
  bib(t_path, _as_month=True)
1158
- elif name.endswith('.xlsx') and '京东商智_店铺来源_三级来源' in name:
1160
+ elif name.endswith('.csv') and '京东商智_店铺来源_三级来源' in name:
1159
1161
  t_path = os.path.join(self.source_path, '京东报表', '店铺来源_三级来源')
1160
1162
  bib(t_path, _as_month=True)
1161
1163
 
@@ -1583,10 +1585,4 @@ def main(is_mysql=False):
1583
1585
 
1584
1586
 
1585
1587
  if __name__ == '__main__':
1586
- main(is_mysql=True)
1587
-
1588
- # conf = myconfig.main()
1589
- # data = conf['Windows']['xigua_lx']['mysql']['local']
1590
- # db_list = conf['Windows']['xigua_lx']['mysql']['数据库集']
1591
- # db_list = [item for item in db_list if item != '聚合数据']
1592
- # print(db_list)
1588
+ main(is_mysql=False)
@@ -13,12 +13,13 @@ from numpy.ma.core import product
13
13
  天猫货品年份基准对照
14
14
  用于聚合数据,通过此数据表进一步可确定商品上架年月
15
15
  """
16
+ username, password, host, port, service_database = None, None, None, None, None,
16
17
  if socket.gethostname().lower() in ['xigua_lx', 'xigua1', 'macbook pro']:
17
18
  conf = myconfig.main()
18
19
  data = conf['Windows']['xigua_lx']['mysql']['local']
19
20
  username, password, host, port = data['username'], data['password'], data['host'], data['port']
20
21
  service_database = {'xigua_lx': 'mysql'}
21
- elif socket.gethostname().lower() in ['company', 'Mac2.local']:
22
+ elif socket.gethostname().lower() in ['company', 'mac2.local']:
22
23
  conf = myconfig.main()
23
24
  data = conf['Windows']['company']['mysql']['local']
24
25
  username, password, host, port = data['username'], data['password'], data['host'], data['port']
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mdbq
3
- Version: 2.7.2
3
+ Version: 2.7.4
4
4
  Home-page: https://pypi.org/project/mdbq
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='2.7.2',
6
+ version='2.7.4',
7
7
  author='xigua, ',
8
8
  author_email="2587125111@qq.com",
9
9
  url='https://pypi.org/project/mdbq',
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes