mdbq 2.8.8__py3-none-any.whl → 2.9.0__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.
@@ -128,6 +128,11 @@ class DataClean:
128
128
  '数据库名': '生意参谋3',
129
129
  '集合名称': '直播分场次效果',
130
130
  },
131
+ {
132
+ '文件简称': 'crm_客户列表_', # 文件名中包含的字符
133
+ '数据库名': '生意参谋3',
134
+ '集合名称': 'crm成交客户',
135
+ },
131
136
  ]
132
137
  for root, dirs, files in os.walk(path, topdown=False):
133
138
  for name in files:
@@ -180,6 +185,8 @@ class DataClean:
180
185
  # new_name = f'py_xg_{os.path.splitext(name)[0]}.csv'
181
186
  # self.save_to_csv(df, root, new_name, encoding='utf-8_sig')
182
187
  # os.remove(os.path.join(root, name))
188
+ elif name.endswith('.csv') and 'crm_客户列表' in name:
189
+ df = pd.read_csv(os.path.join(root, name), encoding='utf-8_sig', header=0, na_filter=False)
183
190
 
184
191
  # 将数据传入 self.datas 等待更新进数据库
185
192
  if not db_name or not collection_name:
@@ -209,6 +216,11 @@ class DataClean:
209
216
  '数据库名': '达摩盘3',
210
217
  '集合名称': 'dmp人群报表',
211
218
  },
219
+ {
220
+ '文件简称': '货品洞察_全店单品', # 文件名中包含的字符
221
+ '数据库名': '达摩盘3',
222
+ '集合名称': '货品洞察_全店单品',
223
+ },
212
224
  ]
213
225
  for root, dirs, files in os.walk(path, topdown=False):
214
226
  for name in files:
@@ -239,6 +251,8 @@ class DataClean:
239
251
  df = pd.read_csv(os.path.join(root, name), encoding='utf-8_sig', header=0, na_filter=False)
240
252
  elif name.endswith('.csv') and 'dmp人群报表_' in name:
241
253
  df = pd.read_csv(os.path.join(root, name), encoding='utf-8_sig', header=0, na_filter=False)
254
+ elif name.endswith('.csv') and '货品洞察_全店单品' in name:
255
+ df = pd.read_csv(os.path.join(root, name), encoding='utf-8_sig', header=0, na_filter=False)
242
256
 
243
257
  # 将数据传入 self.datas 等待更新进数据库
244
258
  if not db_name or not collection_name:
@@ -831,6 +845,9 @@ class DataClean:
831
845
  elif name.endswith('.csv') and 'dmp人群报表_' in name:
832
846
  t_path = os.path.join(self.source_path, '达摩盘', 'dmp人群报表')
833
847
  bib(t_path, _as_month=True)
848
+ elif name.endswith('.csv') and '货品洞察_全店单品' in name:
849
+ t_path = os.path.join(self.source_path, '达摩盘', '货品洞察')
850
+ bib(t_path, _as_month=True)
834
851
 
835
852
  # @try_except
836
853
  def move_sjy(self, path=None, is_except=[]):
@@ -1283,7 +1300,11 @@ def main(is_mysql=False, is_company=False):
1283
1300
  cn.sp_scene_clean(is_except=['except']) # 商品素材
1284
1301
  cn.upload_df() # 上传数据库
1285
1302
 
1286
- if not is_company:
1303
+ if is_company: # 公司移除所有文件
1304
+ files = os.listdir(upload_path)
1305
+ for file in files:
1306
+ os.remove(os.path.join(upload_path, file))
1307
+ else: # 其他主机则进行文件分类
1287
1308
  cn.move_sycm(is_except=['临时文件', ]) # 生意参谋,移到文件到原始文件夹
1288
1309
  cn.move_dmp(is_except=['临时文件', ]) # 达摩盘
1289
1310
  cn.move_sjy(is_except=['临时文件',]) # 生意经,移到文件到原始文件夹
mdbq/company/copysh.py CHANGED
@@ -301,6 +301,30 @@ class TbFiles:
301
301
  now = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
302
302
  print(f'{now} 同步完成!')
303
303
 
304
+ def refresh_excel(self):
305
+ # 刷新共享位置的指定文件/文件夹
306
+ if platform.system() == 'Windows' and socket.gethostname() == 'company':
307
+ excel_path = os.path.join(Share_Path, 'EXCEL报表')
308
+ files = os.listdir(excel_path)
309
+ files = [f'{excel_path}\\{item}' for item in files if item.endswith('.xlsx') or item.endswith('.xls')]
310
+ r = refresh_all.RefreshAll()
311
+ for file in files:
312
+ if '~' in file or 'DS_Store' in file or 'baidu' in file or 'xunlei' in file:
313
+ continue
314
+ if file.endswith('.xlsx') or file.endswith('.xls'):
315
+ r.refresh_excel(file=file)
316
+ time.sleep(5)
317
+
318
+ # 临时加的
319
+ # excel_file = f'\\\\192.168.1.198\\时尚事业部\\01.运营部\\0-电商周报-每周五更新\\0-WLM_运营周报-1012输出.xlsx'
320
+ dir_files = f'\\\\192.168.1.198\\时尚事业部\\01.运营部\\0-电商周报-每周五更新'
321
+ files = os.listdir(dir_files)
322
+ for file in files:
323
+ if file.endswith('.xlsx') and file.startswith(
324
+ '0-WLM_运营周报') and '~' not in file and 'baidu' not in file:
325
+ excel_file = os.path.join(dir_files, file)
326
+ r.refresh_excel(file=excel_file)
327
+
304
328
  def check_upload_mysql(self):
305
329
  # 每天只更新一次
306
330
  today = datetime.date.today()
@@ -407,12 +431,15 @@ def main():
407
431
  )
408
432
  # print(conf)
409
433
  myconfig.write_back(datas=conf) # 写回文件生效
434
+
435
+ if socket.gethostname() == 'company' or socket.gethostname() == 'Mac2.local':
436
+ t.refresh_excel()
410
437
  now = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S ')
411
438
  print(f'{now}数据完成!')
412
439
 
413
- t.sleep_minutes = 5 # 同步前休眠时间
414
- if socket.gethostname() == 'company' or socket.gethostname() == 'Mac2.local':
415
- t.tb_file()
440
+ # t.sleep_minutes = 5 # 同步前休眠时间
441
+ # if socket.gethostname() == 'company' or socket.gethostname() == 'Mac2.local':
442
+ # t.tb_file()
416
443
  time.sleep(600) # 检测间隔
417
444
 
418
445
 
@@ -52,7 +52,9 @@ class DataFrameConverter(object):
52
52
  except Exception as e:
53
53
  print(f'留意错误信息: 位于列 -> {col} -> {e}')
54
54
 
55
- if col.endswith('占比') or col.endswith('率'):
55
+ if (col.endswith('占比') or col.endswith('率') or col.endswith('同比')
56
+ or col.endswith('环比') or col.lower().endswith('roi')
57
+ or col.endswith('产出比')):
56
58
  df = df.astype({col: float}, errors='raise')
57
59
 
58
60
  # 尝试转换合适的数据类型
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mdbq
3
- Version: 2.8.8
3
+ Version: 2.9.0
4
4
  Home-page: https://pypi.org/project/mdbq
5
5
  Author: xigua,
6
6
  Author-email: 2587125111@qq.com
@@ -9,10 +9,10 @@ mdbq/aggregation/query_data.py,sha256=iRgPljgOPE7dzhaaVxRXOEOOKQTmWg6sGsDplNLTvQ
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
12
- mdbq/clean/clean_upload.py,sha256=FJxoEX-2QKuFhrF1ecl_LdZ1uFnVPx4HigNcXdErB28,66561
12
+ mdbq/clean/clean_upload.py,sha256=yMAb6tV9XHhFJbRrCOeaPfszApJ9y5M4-hQGuBSXNqE,67799
13
13
  mdbq/clean/data_clean.py,sha256=ucfslhqXVZoH2QaXHSAWDky0GhIvH9f4GeNaHg4SrFE,104790
14
14
  mdbq/company/__init__.py,sha256=qz8F_GsP_pMB5PblgJAUAMjasuZbOEp3qQOCB39E8f0,21
15
- mdbq/company/copysh.py,sha256=gWaNgRe_rBHBBphch2AHkGAljZRdfqYBn_FC3m_l11A,20061
15
+ mdbq/company/copysh.py,sha256=eFu6focRqm2Njn_XN1KW2ZYJiTv6EYgsdBCLokobyxQ,21572
16
16
  mdbq/company/copysh_bak.py,sha256=NvlXCBZBcO2GIT5nLRYYqhOyHWM1-1RE7DHvgbj6jmQ,19723
17
17
  mdbq/company/home_sh.py,sha256=42CZ2tZIXHLl2mOl2gk2fZnjH2IHh1VJ1s3qHABjonY,18021
18
18
  mdbq/config/__init__.py,sha256=jso1oHcy6cJEfa7udS_9uO5X6kZLoPBF8l3wCYmr5dM,18
@@ -22,7 +22,7 @@ mdbq/config/products.py,sha256=Sj4FSb2dZcMKp6ox-FJdIR87QLgMN_TJ7Z6KAWMTWyw,6214
22
22
  mdbq/config/set_support.py,sha256=xkZCX6y9Bq1ppBpJAofld4B2YtchA7fl0eT3dx3CrSI,777
23
23
  mdbq/config/update_conf.py,sha256=taL3ZqKgiVWwUrDFuaYhim9a72Hm4BHRhhDscJTziR8,4535
24
24
  mdbq/dataframe/__init__.py,sha256=2HtCN8AdRj53teXDqzysC1h8aPL-mMFy561ESmhehGQ,22
25
- mdbq/dataframe/converter.py,sha256=X5Aubm9Z4_bhslcu1-XZzT8X6UpoAW5BFs30RfgfRmE,4460
25
+ mdbq/dataframe/converter.py,sha256=s-5EzHU9HlcSHlKgRd3autGODaKn523av1N0gh_56YY,4614
26
26
  mdbq/log/__init__.py,sha256=Mpbrav0s0ifLL7lVDAuePEi1hJKiSHhxcv1byBKDl5E,15
27
27
  mdbq/log/mylogger.py,sha256=oaT7Bp-Hb9jZt52seP3ISUuxVcI19s4UiqTeouScBO0,3258
28
28
  mdbq/mongo/__init__.py,sha256=SILt7xMtQIQl_m-ik9WLtJSXIVf424iYgCfE_tnQFbw,13
@@ -45,7 +45,7 @@ mdbq/req_post/__init__.py,sha256=jso1oHcy6cJEfa7udS_9uO5X6kZLoPBF8l3wCYmr5dM,18
45
45
  mdbq/req_post/req_tb.py,sha256=PexWSCPJNM6Tv0ol4lAWIhlOwsAr_frnjtcdSHCFiek,36179
46
46
  mdbq/spider/__init__.py,sha256=RBMFXGy_jd1HXZhngB2T2XTvJqki8P_Fr-pBcwijnew,18
47
47
  mdbq/spider/aikucun.py,sha256=jHrdGWBJQaSywx7V-U4YuM6vWkwC5SR5tTOOdB3YU_c,17306
48
- mdbq-2.8.8.dist-info/METADATA,sha256=nsBoL09H03mPKEkiBC_6UFdQjeyF2eK0UINiPaxq9-s,243
49
- mdbq-2.8.8.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
50
- mdbq-2.8.8.dist-info/top_level.txt,sha256=2FQ-uLnCSB-OwFiWntzmwosW3X2Xqsg0ewh1axsaylA,5
51
- mdbq-2.8.8.dist-info/RECORD,,
48
+ mdbq-2.9.0.dist-info/METADATA,sha256=s0ZT23hnWNpOZ5YBPTKigR8XftMlBOTCzH_7Lfuamig,243
49
+ mdbq-2.9.0.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
50
+ mdbq-2.9.0.dist-info/top_level.txt,sha256=2FQ-uLnCSB-OwFiWntzmwosW3X2Xqsg0ewh1axsaylA,5
51
+ mdbq-2.9.0.dist-info/RECORD,,
File without changes