|
@@ -95,10 +95,10 @@ def get_data():
|
|
|
|
|
|
pay_status = df['status'].value_counts() #充值状态占比
|
|
|
|
|
|
- pay_price = df['flow_amount'].value_counts()#充值面额占比
|
|
|
+ pay_price = df.groupby('flow_amount').agg({'flow_amount':'sum'})#充值面额占比
|
|
|
|
|
|
pay_area = df['area'].value_counts().sort_values(ascending=False)#充值地域占比
|
|
|
- #print(pay_area)
|
|
|
+ #print(pay_price)
|
|
|
|
|
|
|
|
|
|
|
@@ -180,6 +180,10 @@ def get_data():
|
|
|
b = list(use_time_count.values)
|
|
|
plt.bar(range(len(a)),b,width=0.6)
|
|
|
plt.xticks(range(len(a)),a,rotation=45)
|
|
|
+ for x, y in enumerate(b):
|
|
|
+ plt.text(x, y+500, "%.0f" %y, ha='center', va= 'bottom')
|
|
|
+ plt.xlabel('充值时长')
|
|
|
+ plt.ylabel('订单数量')
|
|
|
plt.grid(alpha=0.1)
|
|
|
plt.title('充值时长占比')
|
|
|
plt.savefig('use_time.png')
|
|
@@ -211,8 +215,8 @@ def get_data():
|
|
|
fig = plt.figure(figsize=(5,3.2),dpi=180)
|
|
|
_labels = list(pay_price.index)
|
|
|
labels = [int(_labels[i]) for i in range(len(_labels))]
|
|
|
- explode = (0,0,0,0,0.1,0.3)
|
|
|
- plt.pie(pay_price.values,explode =explode,labels=labels,autopct='%1.2f%%', shadow=False,startangle=90,pctdistance = 0.6,labeldistance=1.1)
|
|
|
+ explode = (0.4,0,0,0,0.1,0.2)
|
|
|
+ plt.pie(pay_price['flow_amount'].values,explode =explode,labels=labels,autopct='%1.2f%%', shadow=False,startangle=90,pctdistance = 0.6,labeldistance=1.1)
|
|
|
plt.xticks(pay_price.values)
|
|
|
plt.axis('equal')
|
|
|
plt.title('充值面额占比\n')
|
|
@@ -226,6 +230,10 @@ def get_data():
|
|
|
plt.barh(range(len(a)),b,height=0.6,color='orange')
|
|
|
#plt.xticks(b[::2],b[::2])
|
|
|
plt.yticks(range(len(a)),a)
|
|
|
+ for y, x in enumerate(b):
|
|
|
+ plt.text(x+700, y-0.3, "%.0f" %x,ha='center', va= 'bottom')
|
|
|
+ plt.xlabel('订单数量')
|
|
|
+ plt.ylabel('省份')
|
|
|
plt.grid(alpha=0.1)
|
|
|
plt.title('地域分布')
|
|
|
plt.savefig('area.png')
|
|
@@ -286,7 +294,7 @@ if __name__ == '__main__':
|
|
|
WHERE
|
|
|
apply_date BETWEEN '{}' AND '{}' AND enterprise_id = 54 '''
|
|
|
sql = ''
|
|
|
- for i in range(end_week-6,end_week+1):
|
|
|
+ for i in range(end_week-10,end_week+1):
|
|
|
if i == end_week:
|
|
|
sql += end_sql.format(time_start,time_end)
|
|
|
else :
|