亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

利用python實現(xiàn)周期財務(wù)統(tǒng)計可視化

 更新時間:2019年08月25日 14:31:32   作者:HustWolf  
這篇文章主要給大家介紹了關(guān)于如何利用python實現(xiàn)周期財務(wù)統(tǒng)計可視化的相關(guān)資料,文中通過示例代碼介紹的非常詳細,對大家學習或者使用python具有一定的參考學習價值,需要的朋友們下面來一起學習學習吧

正文之前

上午給爸爸打了個電話慶祝他50歲生日,在此之前搞了個大掃除,看了會知乎,到實驗室已經(jīng)十一點多了。約喜歡的妹子吃飯失敗,以至于工作積極性收到了打擊,所以就寫個程序來統(tǒng)計下開學十一天的財務(wù)消費情況,更清楚的認識自己。

正文

廢話不多說,先放代碼:

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)) #調(diào)節(jié)圖形大小
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%%', #數(shù)值保留固定小數(shù)位
      shadow = False, #無陰影設(shè)置
      startangle =90, #逆時針起始角度設(shè)置
      pctdistance = 0.6) #數(shù)值距圓心半徑倍數(shù)距離
#patches餅圖的返回值,texts1餅圖外label的文本,texts2餅圖內(nèi)部的文本
# x,y軸刻度設(shè)置一致,保證餅圖為圓形
plt.axis('equal')
plt.show()

print("十天合計消費:%d"%(fruit_all+other_all+food_all))

其實就畫了倆圖,一個是折線圖,一個餅圖

最后總結(jié)出來的就是這樣了。。

至于每天怎么做統(tǒng)計的,也放個樣子出來。

每天花個幾分鐘統(tǒng)計下,然后隔段時間來做個統(tǒng)計,更清晰的知道自己最近花了多少錢,錢都去哪兒了。很有利于我脫離月光族的狀態(tài)。。

總結(jié)

以上就是這篇文章的全部內(nèi)容了,希望本文的內(nèi)容對大家的學習或者工作具有一定的參考學習價值,謝謝大家對腳本之家的支持。

相關(guān)文章

最新評論