mdbq 4.0.49__tar.gz → 4.0.50__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 (37) hide show
  1. {mdbq-4.0.49 → mdbq-4.0.50}/PKG-INFO +1 -1
  2. mdbq-4.0.50/mdbq/__version__.py +1 -0
  3. {mdbq-4.0.49 → mdbq-4.0.50}/mdbq/aggregation/query_data.py +30 -6
  4. {mdbq-4.0.49 → mdbq-4.0.50}/mdbq/aggregation/set_typ_dict.py +2 -2
  5. {mdbq-4.0.49 → mdbq-4.0.50}/mdbq.egg-info/PKG-INFO +1 -1
  6. mdbq-4.0.49/mdbq/__version__.py +0 -1
  7. {mdbq-4.0.49 → mdbq-4.0.50}/README.txt +0 -0
  8. {mdbq-4.0.49 → mdbq-4.0.50}/mdbq/__init__.py +0 -0
  9. {mdbq-4.0.49 → mdbq-4.0.50}/mdbq/aggregation/__init__.py +0 -0
  10. {mdbq-4.0.49 → mdbq-4.0.50}/mdbq/log/__init__.py +0 -0
  11. {mdbq-4.0.49 → mdbq-4.0.50}/mdbq/log/mylogger.py +0 -0
  12. {mdbq-4.0.49 → mdbq-4.0.50}/mdbq/myconf/__init__.py +0 -0
  13. {mdbq-4.0.49 → mdbq-4.0.50}/mdbq/myconf/myconf.py +0 -0
  14. {mdbq-4.0.49 → mdbq-4.0.50}/mdbq/mysql/__init__.py +0 -0
  15. {mdbq-4.0.49 → mdbq-4.0.50}/mdbq/mysql/deduplicator.py +0 -0
  16. {mdbq-4.0.49 → mdbq-4.0.50}/mdbq/mysql/mysql.py +0 -0
  17. {mdbq-4.0.49 → mdbq-4.0.50}/mdbq/mysql/s_query.py +0 -0
  18. {mdbq-4.0.49 → mdbq-4.0.50}/mdbq/mysql/unique_.py +0 -0
  19. {mdbq-4.0.49 → mdbq-4.0.50}/mdbq/mysql/uploader.py +0 -0
  20. {mdbq-4.0.49 → mdbq-4.0.50}/mdbq/other/__init__.py +0 -0
  21. {mdbq-4.0.49 → mdbq-4.0.50}/mdbq/other/download_sku_picture.py +0 -0
  22. {mdbq-4.0.49 → mdbq-4.0.50}/mdbq/other/error_handler.py +0 -0
  23. {mdbq-4.0.49 → mdbq-4.0.50}/mdbq/other/otk.py +0 -0
  24. {mdbq-4.0.49 → mdbq-4.0.50}/mdbq/other/pov_city.py +0 -0
  25. {mdbq-4.0.49 → mdbq-4.0.50}/mdbq/other/ua_sj.py +0 -0
  26. {mdbq-4.0.49 → mdbq-4.0.50}/mdbq/pbix/__init__.py +0 -0
  27. {mdbq-4.0.49 → mdbq-4.0.50}/mdbq/pbix/pbix_refresh.py +0 -0
  28. {mdbq-4.0.49 → mdbq-4.0.50}/mdbq/pbix/refresh_all.py +0 -0
  29. {mdbq-4.0.49 → mdbq-4.0.50}/mdbq/redis/__init__.py +0 -0
  30. {mdbq-4.0.49 → mdbq-4.0.50}/mdbq/redis/getredis.py +0 -0
  31. {mdbq-4.0.49 → mdbq-4.0.50}/mdbq/spider/__init__.py +0 -0
  32. {mdbq-4.0.49 → mdbq-4.0.50}/mdbq/spider/aikucun.py +0 -0
  33. {mdbq-4.0.49 → mdbq-4.0.50}/mdbq.egg-info/SOURCES.txt +0 -0
  34. {mdbq-4.0.49 → mdbq-4.0.50}/mdbq.egg-info/dependency_links.txt +0 -0
  35. {mdbq-4.0.49 → mdbq-4.0.50}/mdbq.egg-info/top_level.txt +0 -0
  36. {mdbq-4.0.49 → mdbq-4.0.50}/setup.cfg +0 -0
  37. {mdbq-4.0.49 → mdbq-4.0.50}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: mdbq
3
- Version: 4.0.49
3
+ Version: 4.0.50
4
4
  Home-page: https://pypi.org/project/mdbq
5
5
  Author: xigua,
6
6
  Author-email: 2587125111@qq.com
@@ -0,0 +1 @@
1
+ VERSION = '4.0.50'
@@ -244,8 +244,8 @@ class MysqlDatasQuery:
244
244
  df_real_sales = self._get_real_sales(shop_list=shop_list)
245
245
  df_shop_gmv = self._get_shop_gmv(shop_list=shop_list)
246
246
  df_tg_data = self._get_tg_data(shop_list=shop_list)
247
- df = df_shop_gmv.merge(df_real_sales, on=['日期', '店铺名称'], how='left')
248
- df = df.merge(df_tg_data, on=['日期', '店铺名称'], how='left')
247
+ df = df_shop_gmv.merge(df_real_sales, on=['日期', '店铺名称'], how='outer') # 平台数据合并销售数据
248
+ df = df.merge(df_tg_data, on=['日期', '店铺名称'], how='outer') # 合并推广数据
249
249
  df.fillna(0, inplace=True)
250
250
  set_typ = SET_TYP_DICT[f'{db_name}_{table_name}']
251
251
  return df, {
@@ -266,7 +266,7 @@ class MysqlDatasQuery:
266
266
 
267
267
  def _get_tg_data(self, db_name='聚合数据', table_name='多店推广场景_按日聚合', shop_list:dict=None):
268
268
  start_date, end_date = self.months_data(num=self.months)
269
- projection = ['日期', '店铺名称', '营销场景', '花费', '成交金额']
269
+ projection = ['日期', '店铺名称', '营销场景', '花费']
270
270
  df = self.download_manager.data_to_df(
271
271
  db_name=db_name,
272
272
  table_name=table_name,
@@ -275,14 +275,13 @@ class MysqlDatasQuery:
275
275
  projection=projection,
276
276
  )
277
277
  if df.empty:
278
- return pd.DataFrame(columns=['日期', '店铺名称', '实际消耗', '推广成交金额'])
278
+ return pd.DataFrame(columns=['日期', '店铺名称', '实际消耗'])
279
279
  df = df[(df['店铺名称'].isin(shop_list.keys()))]
280
280
  df = df.astype({
281
281
  '日期': 'datetime64[ns]',
282
282
  '花费': 'float64',
283
- '成交金额': 'float64'
284
283
  })
285
- df = df.groupby(['日期', '店铺名称'], as_index=False).agg({'花费': 'sum', '成交金额': 'sum'}).rename(columns={'花费': '实际消耗', '成交金额': '推广成交金额'})
284
+ df = df.groupby(['日期', '店铺名称'], as_index=False).agg({'花费': 'sum'}).rename(columns={'花费': '实际消耗'})
286
285
  df['店铺名称'] = df['店铺名称'].map(shop_list)
287
286
  return df
288
287
 
@@ -351,8 +350,33 @@ class MysqlDatasQuery:
351
350
  }).rename(
352
351
  columns={'商店名称': '店铺名称', '验收日期': '日期', '金额': '实际营收'}
353
352
  )
353
+ df_ziying_sales = self._get_ziying_sales(shop_list=shop_list)
354
+ df = pd.concat([df, df_ziying_sales], ignore_index=True) # e3 合并京东自营业绩
354
355
  return df
355
356
 
357
+ def _get_ziying_sales(self, db_name='京东数据3', table_name='京东自营_vc品牌业绩', shop_list:dict=None):
358
+ """获取京东自营业绩"""
359
+ start_date, end_date = self.months_data(num=self.months)
360
+ projection = ['日期', '店铺名称', '收入']
361
+ df = self.download_manager.data_to_df(
362
+ db_name=db_name,
363
+ table_name=table_name,
364
+ start_date=start_date,
365
+ end_date=end_date,
366
+ projection=projection,
367
+ )
368
+ if df.empty:
369
+ return pd.DataFrame(columns=['日期', '店铺名称', '收入'])
370
+ df = df[(df['店铺名称'].isin(shop_list.keys()))]
371
+ df = df.astype({
372
+ '日期': 'datetime64[ns]',
373
+ '收入': 'float64'
374
+ })
375
+ df = df.groupby(['日期', '店铺名称'], as_index=False).agg({'收入': 'sum'}).rename(columns={'收入': '实际营收'})
376
+ df['店铺名称'] = df['店铺名称'].map(shop_list)
377
+ return df
378
+
379
+
356
380
  # @error_handler.log_on_exception(logger=logger)
357
381
  def tg_wxt(self, db_name='聚合数据', table_name='天猫_主体报表', is_maximize=True):
358
382
  start_date, end_date = self.months_data(num=self.months)
@@ -573,12 +573,12 @@ SET_TYP_DICT = {
573
573
  '聚合数据_多店聚合_日报': {
574
574
  '日期': 'date',
575
575
  '店铺名称': 'varchar(255)',
576
+ '实际营收': 'decimal(12,2)',
577
+ '支付金额': 'decimal(12,2)',
576
578
  '访客数': 'int',
577
579
  '浏览量': 'int',
578
- '支付金额': 'decimal(12,2)',
579
580
  '支付买家数': 'int',
580
581
  '支付件数': 'int',
581
- '实际营收': 'decimal(12,2)',
582
582
  '实际消耗': 'decimal(10,2)',
583
583
  '推广成交金额': 'decimal(12,2)',
584
584
  },
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: mdbq
3
- Version: 4.0.49
3
+ Version: 4.0.50
4
4
  Home-page: https://pypi.org/project/mdbq
5
5
  Author: xigua,
6
6
  Author-email: 2587125111@qq.com
@@ -1 +0,0 @@
1
- VERSION = '4.0.49'
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