|
@@ -45,7 +45,6 @@ def description():
|
|
|
|
|
|
df = db.dm.pd_data_sql(sql)
|
|
df = db.dm.pd_data_sql(sql)
|
|
|
|
|
|
- # print(df)
|
|
|
|
|
|
|
|
df["data_type"] = 'all'
|
|
df["data_type"] = 'all'
|
|
df['type'] = '2'
|
|
df['type'] = '2'
|
|
@@ -59,7 +58,6 @@ def description():
|
|
|
|
|
|
|
|
|
|
def image():
|
|
def image():
|
|
-
|
|
|
|
sql = """select signature,sum(consume_amount) consume_amount,
|
|
sql = """select signature,sum(consume_amount) consume_amount,
|
|
sum(click_times) click_times,
|
|
sum(click_times) click_times,
|
|
sum(view_times) view_times,
|
|
sum(view_times) view_times,
|
|
@@ -76,7 +74,8 @@ def image():
|
|
min(media_format) media_format,
|
|
min(media_format) media_format,
|
|
min(video_length) video_length,
|
|
min(video_length) video_length,
|
|
min(video_bit_rate) video_bit_rate,
|
|
min(video_bit_rate) video_bit_rate,
|
|
- 0 max_media_size
|
|
|
|
|
|
+ 0 max_media_size,
|
|
|
|
+ min(width)/if(min(height),min(height),1) aspect_ratio
|
|
from (select replace(signature,' ,','') as signature ,
|
|
from (select replace(signature,' ,','') as signature ,
|
|
sum(cost) consume_amount,
|
|
sum(cost) consume_amount,
|
|
sum(click_count) click_times,
|
|
sum(click_count) click_times,
|
|
@@ -88,9 +87,9 @@ def image():
|
|
replace (min(preview_url),' ,','') as content,
|
|
replace (min(preview_url),' ,','') as content,
|
|
if(is_video=1,2,1) type,
|
|
if(is_video=1,2,1) type,
|
|
if(locate(',',signature)>0,0,1) single_img,
|
|
if(locate(',',signature)>0,0,1) single_img,
|
|
- min(replace(if(left (width ,2)='0,',substring(width ,3),width) ,',0','')) width ,
|
|
|
|
- min(replace(if(left (height ,2)='0,',substring(height ,3),height) ,',0','')) height,
|
|
|
|
- min(replace(if(left (size ,2)='0,',substring(size ,3),size) ,',0','')) media_size ,
|
|
|
|
|
|
+ min(width) width ,
|
|
|
|
+ min(height) height,
|
|
|
|
+ min(replace(if(left (size ,2)='0,',substring(size ,3),size) ,',0','')) media_size,
|
|
min(replace(format ,' ,','')) media_format,
|
|
min(replace(format ,' ,','')) media_format,
|
|
min(video_length) video_length,
|
|
min(video_length) video_length,
|
|
min(video_bit_rate) video_bit_rate
|
|
min(video_bit_rate) video_bit_rate
|
|
@@ -112,7 +111,7 @@ def image():
|
|
max_size = 0
|
|
max_size = 0
|
|
for size_data in size_list:
|
|
for size_data in size_list:
|
|
if size_data != 'None':
|
|
if size_data != 'None':
|
|
- if float(size_data) > max_size:
|
|
|
|
|
|
+ if float(size_data) > float(max_size):
|
|
max_size = str(size_data)
|
|
max_size = str(size_data)
|
|
df['max_media_size'][i] = max_size
|
|
df['max_media_size'][i] = max_size
|
|
|
|
|
|
@@ -120,8 +119,11 @@ def image():
|
|
df["data_type"] = 'all'
|
|
df["data_type"] = 'all'
|
|
|
|
|
|
key = ["signature"]
|
|
key = ["signature"]
|
|
- tag = ['media_size', 'media_format', 'video_length', 'video_bit_rate', 'use_times', "view_times", "click_times", "novels", "start_date", "end_date", "create_by", "single_img",
|
|
|
|
- "content", 'consume_amount', 'type', 'width', 'height']
|
|
|
|
|
|
+ tag = ['media_size', 'media_format', 'video_length', 'video_bit_rate',
|
|
|
|
+ 'max_media_size', 'use_times', "view_times",
|
|
|
|
+ "click_times",
|
|
|
|
+ "novels", "start_date", "end_date", "create_by", "single_img",
|
|
|
|
+ "content", 'consume_amount', 'type', 'width', 'height', 'aspect_ratio']
|
|
table = "t_ads_media"
|
|
table = "t_ads_media"
|
|
|
|
|
|
db.zx_ads.dfsave2mysql(df, table, key, tag)
|
|
db.zx_ads.dfsave2mysql(df, table, key, tag)
|
|
@@ -140,13 +142,14 @@ min(media) media,
|
|
min(channel) channel ,
|
|
min(channel) channel ,
|
|
min(type) type,
|
|
min(type) type,
|
|
if(locate(',',signature)>0,0,1) single_img,
|
|
if(locate(',',signature)>0,0,1) single_img,
|
|
-min(width) width ,
|
|
|
|
|
|
+min(width) width,
|
|
min(height) height,
|
|
min(height) height,
|
|
min(media_size) media_size ,
|
|
min(media_size) media_size ,
|
|
min(media_format) media_format,
|
|
min(media_format) media_format,
|
|
min(video_length) video_length,
|
|
min(video_length) video_length,
|
|
min(video_bit_rate) video_bit_rate,
|
|
min(video_bit_rate) video_bit_rate,
|
|
-0 max_media_size
|
|
|
|
|
|
+0 max_media_size,
|
|
|
|
+min(width)/if(min(height),min(height),1) aspect_ratio
|
|
from
|
|
from
|
|
(select replace(signature ,' ,','') as signature,title,description article,
|
|
(select replace(signature ,' ,','') as signature,title,description article,
|
|
sum(click_count) click_times,
|
|
sum(click_count) click_times,
|
|
@@ -156,8 +159,8 @@ sum(cost) consume_amount,
|
|
group_concat(distinct book) novels,
|
|
group_concat(distinct book) novels,
|
|
min(dt) start_date,max(dt) end_date,
|
|
min(dt) start_date,max(dt) end_date,
|
|
min(replace(preview_url ,' ,','')) media,
|
|
min(replace(preview_url ,' ,','')) media,
|
|
-min(replace(if(left (width ,2)='0,',substring(width ,3),width) ,',0','')) width ,
|
|
|
|
-min(replace(if(left (height ,2)='0,',substring(height ,3),height) ,',0','')) height ,
|
|
|
|
|
|
+min(width) width ,
|
|
|
|
+min(height) height,
|
|
min(replace(if(left (size ,2)='0,',substring(size ,3),size) ,',0','')) media_size ,
|
|
min(replace(if(left (size ,2)='0,',substring(size ,3),size) ,',0','')) media_size ,
|
|
min(replace(format ,' ,','')) media_format,
|
|
min(replace(format ,' ,','')) media_format,
|
|
min(video_length) video_length,
|
|
min(video_length) video_length,
|
|
@@ -165,9 +168,10 @@ min(video_bit_rate) video_bit_rate,
|
|
type channel,
|
|
type channel,
|
|
if(is_video=1,2,1) type,
|
|
if(is_video=1,2,1) type,
|
|
if(locate(',',signature)>0,0,1) single_img
|
|
if(locate(',',signature)>0,0,1) single_img
|
|
-from dw_image_cost_day where signature is not null and signature!=''
|
|
|
|
-GROUP BY signature,title,description,type,is_video) as foo
|
|
|
|
-group by signature ,title,article """
|
|
|
|
|
|
+from dw_image_cost_day where signature is not null and signature!=''
|
|
|
|
+GROUP BY signature,title,description,type,is_video) as foo
|
|
|
|
+group by signature ,title ,article
|
|
|
|
+ """
|
|
|
|
|
|
# df = db.dm.getData_pd(sql)
|
|
# df = db.dm.getData_pd(sql)
|
|
df = db.dm.pd_data_sql(sql)
|
|
df = db.dm.pd_data_sql(sql)
|
|
@@ -179,14 +183,15 @@ group by signature ,title,article """
|
|
max_size = 0
|
|
max_size = 0
|
|
for size_data in size_list:
|
|
for size_data in size_list:
|
|
if size_data != 'None':
|
|
if size_data != 'None':
|
|
- if float(size_data) > max_size:
|
|
|
|
|
|
+ if float(size_data) > float(max_size):
|
|
max_size = str(size_data)
|
|
max_size = str(size_data)
|
|
df['max_media_size'][i] = max_size
|
|
df['max_media_size'][i] = max_size
|
|
|
|
|
|
key = ["signature", 'title', 'article']
|
|
key = ["signature", 'title', 'article']
|
|
- tag = ['media_size', 'media_format', 'video_length', 'video_bit_rate', 'max_media_size', 'use_times', "view_times",
|
|
|
|
|
|
+ tag = ['media_size', 'media_format', 'video_length', 'video_bit_rate', 'max_media_size',
|
|
|
|
+ 'use_times', "view_times",
|
|
"click_times", "novels", "start_date", "end_date", "type", "channel",
|
|
"click_times", "novels", "start_date", "end_date", "type", "channel",
|
|
- 'consume_amount', 'single_img', 'media', 'width', 'height']
|
|
|
|
|
|
+ 'consume_amount', 'single_img', 'media', 'width', 'height', 'aspect_ratio']
|
|
table = "t_ads_idea"
|
|
table = "t_ads_idea"
|
|
|
|
|
|
db.zx_ads.dfsave2mysql(df, table, key, tag)
|
|
db.zx_ads.dfsave2mysql(df, table, key, tag)
|
|
@@ -205,3 +210,6 @@ if __name__ == '__main__':
|
|
# description()
|
|
# description()
|
|
# image()
|
|
# image()
|
|
# adcreative()
|
|
# adcreative()
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|