利用python实现周期财务统计可视化-创新互联

正文之前

为青原等地区用户提供了全套网页设计制作服务,及青原网站建设行业解决方案。主营业务为成都做网站、成都网站设计、青原网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!

上午给爸爸打了个电话庆祝他50岁生日,在此之前搞了个大扫除,看了会知乎,到实验室已经十一点多了。约喜欢的妹子吃饭失败,以至于工作积极性收到了打击,所以就写个程序来统计下开学十一天的财务消费情况,更清楚的认识自己。

正文


废话不多说,先放代码:


import matplotlib.pyplot as plt
import matplotlib
from pylab import mpl
plt.rcParams['font.sans-serif']=['SimHei']


def getAll(x):
 s=0
 for i in x:
  s+=i
 return s

sump = [374.9,70,85.5,72.9,33.7,14.8,35.4,30.1,66.52,114.3,-13]
fruit = [0,0,0,10,0,0,0,0,35,0,0]
other = [338.6,50,53.8,49.5,10,0,0,0,6.42,92,-34]
food = []
for i in range(len(sump)):
 food.append(sump[i] - fruit[i] - other[i])

date = []

for i in range(11):
 date.append("8."+str(i+14))

plt.xlabel(u"时间")
plt.ylabel(u"消费")
plt.plot(date,sump)
plt.plot(date,fruit)
plt.plot(date,other)
plt.plot(date,food)

plt.legend()
plt.show()


sump_all = getAll(sump)
fruit_all = getAll(fruit)
other_all = getAll(other)
food_all = getAll(food)

plt.figure(figsize=(6,9)) #调节图形大小
labels = [u'Food '+str(int(food_all)),u'Fruit '+str(fruit_all),u'Other '+str(other_all)] #定义标签
sizes = [food_all,fruit_all,other_all] #每块值
colors = ['red','yellowgreen','lightskyblue'] #每块颜色定义
explode = (0,0,0) #将某一块分割出来,值越大分割出的间隙越大
patches,text1,text2 = plt.pie(sizes,
      explode=explode,
      labels=labels,
      colors=colors,
      autopct = '%3.2f%%', #数值保留固定小数位
      shadow = False, #无阴影设置
      startangle =90, #逆时针起始角度设置
      pctdistance = 0.6) #数值距圆心半径倍数距离
#patches饼图的返回值,texts1饼图外label的文本,texts2饼图内部的文本
# x,y轴刻度设置一致,保证饼图为圆形
plt.axis('equal')
plt.show()

print("十天合计消费:%d"%(fruit_all+other_all+food_all))

网站题目:利用python实现周期财务统计可视化-创新互联
转载来于:https://www.cdcxhl.com/article22/coghcc.html

成都网站建设公司_创新互联,为您提供标签优化App开发虚拟主机网站维护网站排名品牌网站建设

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

搜索引擎优化