def fx(times, lx): nums, payMoney, sellerMoney, rateMoney = [], [], [], [] for i in times: df = dfInit(i[0], i[1], lx) nums.append([i[2], df.shape[0]]) org = round(sum(df.org_money), 2) seller = round(sum(df.seller_money), 2) payMoney.append([i[2], org]) rate = round(org - seller, 2) sellerMoney.append([i[2], seller]) rateMoney.append([i[2], rate]) return nums, payMoney, sellerMoney, rateMoney
# ax = plt.gca() # ax.spines['right'].set_color('none') # ax.spines['top'].set_color('none') # plt.xlabel('订单量') # plt.ylabel('商户名称+ID') # plt.title(date + '月份百望商城订单量前20商家') # ax.set_yticks(range(len(sname))) # ax.set_yticklabels(sname) # plt.annotate(r'$author:zxz$', (250, 0), color='#C4C4C4') # plt.show() if __name__ == '__main__': sdate = input('请输入开始时间:') jx = int(input('请输入间隙时间:')) date = input('请输入时间:') startdate = sdate + ' 0:0:0' starttime = time.strptime(startdate, "%Y-%m-%d %H:%M:%S") starttime = int(time.mktime(starttime)) timess = times(starttime, jx) dfs = [] for t in timess: dfs.append(dfInit(t[0], t[1], 1)) dfqb = dfqb(dfs) seller = sellerMonth(dfqb) print('销售额:') print(seller[0]) print('订单量:') print(seller[1]) printSeller(seller, date)
plt.rcParams['font.sans-serif'] = ['SimHei'] pay = payMethod(df) plt.pie([i[1] for i in pay], labels=[i[0] + ':' + str(i[1]) for i in pay], startangle=90, autopct='%1.1f%%') plt.title(date + '百望商城支付方式饼状图') plt.annotate(r'$author:Ariel$', (-0.5, 0), color='#C4C4C4') plt.legend() plt.show() if __name__ == '__main__': sdate = input('请输入开始时间:') date = input('请输入时间:') startdate = sdate + ' 0:0:0' starttime = time.strptime(startdate, "%Y-%m-%d %H:%M:%S") starttime = int(time.mktime(starttime)) timess = times(starttime) endtime = timess[-1][1] df = tjPt(starttime, endtime) printOrderOrg(starttime, endtime, date) bw = fx(timess, 1) jd = fx(timess, 2) wy = fx(timess, 4) printT(date, bw, jd, wy) printPlot(date, bw, jd, wy) printXzyh(timess, date) dfpay = dfInit(starttime, endtime, 5) payPrint(date, dfpay)
import matplotlib.pyplot as plt from connectMysql.connect import dfInit from connectMysql.connect import Difuid from connectMysql.connect import seller from connectMysql.connect import Difuyhid, payMethod, xzdfyh, pt, xzdfsj import time date = input('请输入时间:') startdate = date + ' 0:0:0' enddate = date + ' 23:59:59' starttime = time.strptime(startdate, "%Y-%m-%d %H:%M:%S") starttime = int(time.mktime(starttime)) endtime = time.strptime(enddate, "%Y-%m-%d %H:%M:%S") endtime = int(time.mktime(endtime)) wydf = dfInit(starttime, endtime, 4) jddf = dfInit(starttime, endtime, 2) bwdf = dfInit(starttime, endtime, 1) df = dfInit(starttime, endtime, 8) plt.rcParams['font.sans-serif'] = ['SimHei'] # 京东商品销量前几商品 plt.figure() ls = Difuid(jddf) l = ls[0] xl = l.copy() goodName = ls[1] l.reverse() name = [i[0] for i in l] colleges = [i[1] for i in l]