SoumaJ
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    1102程式設計 === 開會內容 --- [→小組共筆←](https://hackmd.io/xwWBm1TpSteP4HY3h4L3BA) 我們有做 只是不知連結被誰刪掉了qq 現在補上還有分數嗎 --- # 期末報告 ## Colab https://colab.research.google.com/drive/119Q531mKVCJTcmZGypuZFfIWs54ARWdj?usp=sharing ## PPT (https://docs.google.com/presentation/d/1-1_L91faiQKdysE05j66lQpn8XLlmkHc/edit?usp=sharing&ouid=118391773169092833632&rtpof=true&sd=true) ## 內容 研究題目:南美洲人均GDP與HDI之研究 國立暨南國際大學 院學士班 董哲安 1 國立暨南國際大學 院學士班 王雅蓁 2 國立暨南國際大學 資管系 廖唯任(小天使) 3 國立暨南國際大學 資管系 賴芃希(小天使) 4 聯絡方式: s110251001@mail1.ncnu.edu.tw s110251020@mail1.ncnu.edu.tw from google.colab import drive drive.mount('/content/drive') ### **研究動機**: 在一般人眼中,說到世界,我們能夠講出多少國家呢?而又是所有人都知道世界是由幾大洲幾大洋組成的嗎?坐下來仔細一想,整個世界實際上是有七大洲的。包含亞洲、歐洲、非洲、北美洲、南美洲、南極洲和大洋洲。但當我們開始討論時,我們發現,我們好像僅對歐亞北美比較了解爾已。非洲是因為對我們來說相對落後,國家數目也多,而且又因殖民原因被切的國不像國,家不像家,因此暫不討論;大洋洲太過於細碎,且國家型態太小,很多地方還比不上台灣的一個縣,台灣已經夠小了,若要討論大洋洲,還不如把台灣拆開來看,因此也不適合討論;南極洲雖然很大,卻沒有國家,因此,我們把目光一轉,想討論一下南美洲 究竟南美算是先進還是落後?沒有人能給出一個確切的答案。以軍事實力來說,巴西是個強大的國家,那他先進嗎?人民幸福嗎?我們不知道。曾經的一大強國,甚至有能力和英國叫板的阿根廷,他們又如何呢?我們也不知道,可是我們該如何來衡定這些標準呢?這些國家離我們太遠,我們對他們的認知也留在以前高中上過的粗淺地理與歷史而已。對我們來說,最唾手可得的資量當然是來自於網路,且更新的最快,因此,我們打算以HDI代表國人幸福指數;人均GDP代表國家先進程度來進行討論。 ### 研究問題: **南美洲人均GDP與HDI之關係** ### **資料來源:** https://zh.wikipedia.org/wiki/%E5%8D%97%E7%BE%8E%E6%B4%B2%E7%BB%8F%E6%B5%8E https://zh.wikipedia.org/zh-tw/%E4%BA%BA%E9%A1%9E%E7%99%BC%E5%B1%95%E6%8C%87%E6%95%B8%E5%88%97%E8%A1%A8 http://theory.people.com.cn/BIG5/n/2015/0630/c143844-27229030.html https://finance.technews.tw/2021/10/08/three-central-american-countries-will-resume-economic-growth/ https://data.worldbank.org.cn/indicator/NY.GDP.PCAP.CD?locations=VE ### **程式碼內容部分** import pandas as pd import numpy as np import matplotlib.pyplot as plt df = pd.read_excel('/content/drive/MyDrive/’___TestData’/南美人均GDP.xlsx') df --- sum=df['人均國內生產總值(美元)'].sum() n=df['人均國內生產總值(美元)'].count() print(f'總和={sum}, 樣本數={n}') plt.hist(df['人均國內生產總值(美元)'], bins=range(3000, 18000, 100)) plt.show() --- import pandas as pd import numpy as np import matplotlib.pyplot as plt dfLorenz=df[:] se=dfLorenz['人均國內生產總值(美元)'].sort_values() cumulativeSum=0 i=0 xx=[] yy=[] for x in se: i=i+1 cumulativeSum+=x xx.append(i/n) yy.append(cumulativeSum/sum) plt.plot([0,1], linestyle = 'dotted') #散佈圖 plt.scatter(x=xx,y=yy,s=1.0) plt.axis('square') plt.xlim(0,1) plt.ylim(0,1) print('羅倫茲曲線(Lorenz curve)') plt.show() B=np.trapz(yy,xx) A=0.5-B gini=A/(A+B) print(f'吉尼係數') print(gini) --- import pandas as pd import numpy as np import matplotlib.pyplot as plt data=pd.read_excel('/content/drive/MyDrive/’___TestData’/南美HDI.xlsx') data --- import pandas as pd import matplotlib.pyplot as plt x=[] y=[] for i in range(len(df['國家'])): for j in range(len(data['國家'])): if df['國家'][i]==data['國家'][j]: x.append(df['人均國內生產總值(美元)'][i]) y.append(data['人類發展指數HDI'][j]) #散佈圖 fig=plt.figure() ax=fig.add_subplot(1,1,1) ax.scatter(x,y) plt.show() ### 研究發現: 依照聯合國開發計畫署等機構的公布, 若低於0.2表示指數等級極低; 0.2-0.29表示指數等級低; 0.3-0.39表示指數等級中; 0.4-0.59表示指數等級高; 0.6以上表示指數等級極高。 而數值越接近0代表該國家的平復差距約小(也就是越好),在我們的研究中,我們把南美洲設想成是一個大型國家,而原先各國的人均GDP[人均國內生產總值(美元)當作是各個不同個體的收入,得到其吉尼係數為0.279,以分類來說處於等級低,像我們呈現的是他們以各國代表的人民貧富差距不大,同理可得各國間的貧富差距不大,得知南美洲並沒有哪個國間稱霸整個南美洲。 而談論HDI,我們知道HDI為人類發展水準,其中: 0.800–1.000 (極高) 0.700–0.799 (高) 0.550–0.699 (中) 0.350–0.549 (低) 0.001–0.349 (極低) 而在我們的程式中得到南美洲中除了圭亞那以外全部皆大於等於「高」,可知南美洲大部分國家的發展水準已達相當優秀的程度。然而,HDI的成績是由:平均壽命、受教育年限和人均國民所得所得出,最後一點的人均國民所得極為前面我們所討論的吉尼係數部分有用到。這時,我們就想到,人均國民所得是否對於發展水準佔有很大的一席之地,人均高的國家是否平均壽命與教育年限相對的也會高。於是我們看到最後的一張圖表,在圖表中,我們的x軸代表的是人均GDP,y軸為HDI。 看過去,我們發現整張圖表有很明顯的正相關。在我們的研究中,我們皆假設平均壽命與教育年限不在HDI計算中,但HDI也會同樣表示前兩者,這是一個HDI包含平均壽命與教育年限,但HDI不屬於前二者。而既然我們的圖像我們表係前有明顯正相關,在我們的研究中,就同時能夠得出人均GDP高的國家也就同時擁有較高的平均壽命與教育年限。 ### 結論: 透過羅倫茲曲線與吉尼係數的程式呈現,我們得到南美洲各國之間的貧富差距不大,但不代表其各國內的貧富差距不大,因為在我們的研究中我們是把各國當作個體,整個國家當作是一個人,完整12個國家合起來成為一個國名為南美洲的國家,然後主要來討論這個國家。而我們討論出其各國間貧富差距不大,就代表並沒有如同亞洲這般,日、韓、星三國的人均收入特別高,其他皆處於中高或中等而已,總體呈現一反轉L型曲線;整個南美洲大概各國間呈現的是一條開口向上的扁U形曲線,也透過吉尼係數得出的0.279得到驗證南美洲為指數等級低(優)。 接下來將HDI導入整個研究得出的散佈圖呈現整體為一高度正相關,也呼應我們的研究主題,得到在南美洲中,人均收入較高國家相對的國家發展水準(HDI)也較高,代表高壽入國家的人均壽命和平均教育年限也較高。 在我們的散佈圖中,最接近右上為最高分,越靠左下越低分,簡單討論各國,得到第一名為智利,第二名為烏拉圭,而最後一名為委內瑞拉。 智利最主要的產業為對外出口,約占其總GDP的三分之一,其貿易物中各產業銅礦, 53.6% 葡萄, 8.4% 化學品, 5.0% 海產, 4.5% 紙類, 3.3% 酒2.4% 木材, 2.2% 黃金, 2.1% 。預期壽命為80.5歲,全球第28位;平均教育年9.7年,全球第57位。 而烏拉圭主要產業仍為對外出口,主要貿易物為農業與酪農業,出口產品排名第1至第3分別為牛肉、木材及大豆,分別站對外輸出的23%、13%與11%。平均壽命為77歲,全球第44位;平均教育年為8.5年,全球第87位。 最低分的委內瑞拉,主要出口原油、石油產品、鋁礦、鐵礦砂、化學製品、農產品,主要進口農產品、家畜、原物料、機械與設備、運輸設備、建築材料、醫療設備、石油產品、化學製品、鋼鐵製品。人均壽命為74.1,全球第84位;平均教育年為7.6,全球第106位。 由以上三國的後二點(平均壽命/平均教育年)可再次確認我們的研究結果正確。 # 2/14 第一週 ## 內容 >+加 >-減 >*乘pow >/除 >%餘 >**次方 >//商數 運算順序為每一項的後面定義前面 由上往下一條一條看 同一條中若有()則先看括號 x=1的(=)意思是「設定」,而(x)為「變數」 寫法1 設定x與y 最後在print後面的括弧裡放入算式 例子: x=5 y=3 print(x*y) 得15 寫法2 僅設定x 第二條為x()=n 括號為運算符號,n為常數 例子: x=4 x//=1 print(x) 得4 # 2/21第二週 ## 內容 impport ==>匯入,後面加入模組 exp:import math print(math.floor(x)) print(math.ceil(x)) floor>>無條件捨去 ceil >>無條件進入 <運算的意義> x=min(5,10,8,2,25) print(x) '將5,10,8,2,25當作「參數」傳入至min(函數) min將運算在該五數字中何者最小 並將結果「設定」到x中 最終印出x結果' (#)為註記 python不會將其運算 #匯入math模組 import math #把4.5當作參數,傳入到math.floor()函數中 #把math.floor()運算的結果設定給x變數 print(math.floor(4.5)) #把4.5當作參數,傳入到math.ceil()函數中 #把math.ceil()運算的結果設定給y變數 print(math.ceil(4.5)) 題目(2/21) import math a=(math.sqrt(7)-math.sqrt(5))/(math.sqrt(7)+math.sqrt(5)) #sqrt是指平方根 print((pow(a,3))+pow(a,-3)) #pow為次方使用模式 題目2 x=pow(1.25,37) x<5000 and x>4000 print(x)=3851.859 x=pow(1.25,38) x<5000 and x>4000 print(x)=4814.824# 題目3 x=1/(math.sqrt(2)+1) y=x**4+2*x**3-3*x**2+5*x+1 print(y)=2.727922# ## 作業 作業題目 https://docs.google.com/a/tea.nknush.kh.edu.tw/viewer?a=v&pid=sites&srcid=dGVhLm5rbnVzaC5raC5lZHUudHd8bWF0aHxneDplYjFmOGRiODNhMmZlYWM 填充第8題===>![](https://i.imgur.com/v0hWJpv.png) import math x=(math.sqrt(11)+3)/(math.sqrt(11)-3) print(pow(x,3)+pow(x,-3)) answer:7940 https://imcct.net/UserFiles/files/%E7%AC%AC17%E5%B1%86IMC%E8%A4%87%E8%B3%BD10%E5%B9%B4%E7%B4%9A.pdf 選擇第4題===>![](https://i.imgur.com/DOEZzjn.png) import math x=(3+math.sqrt(8))/2 a=4*x**4-8*x**3-15*x**2+13*x+49 print(a) answer=50 https://docs.google.com/a/tea.nknush.kh.edu.tw/viewer?a=v&pid=sites&srcid=dGVhLm5rbnVzaC5raC5lZHUudHd8bWF0aHxneDo0MTZlNzcyY2I2ZmFiNWRi 填充13題===>![](https://i.imgur.com/XMCwlVN.png) import math x=(1+math.sqrt(2))/(1-math.sqrt(2)) print(pow(x,3)+pow(x,-3)) answer=198 --- ![](https://i.imgur.com/bBuCGxn.png) #(5) import math x=math.sqrt(5)-2 y=x**2+1/x**2 print(y) answer=17.999999999999982≒18 #(5) ![](https://i.imgur.com/2DuBIkN.png) #(B) a=25*13**2-15**2 print(a) 4000 b=16*17**2-18**2 print(b) 4300 c=9*21**2-13**2 print(c) 3800 d=4*31**2-12**2 print(d) 3700 answer:(B) ![](https://i.imgur.com/MZlcv6m.png)(改成小數後第六位四捨五入) #(3.950798) x=2*1.99**3-4*1.99**2-3*1.99+10 print(x) answer:3.950798 # 3/7 第四週 ## 內容 定義 x=4。。。x is of type {int} 整數INT型態 x="apple" x is of type{str} 字串STR型態 定義方法 x=str(3)>>>x will be '3' ,3存為str型態並設定給x y=int(3)>>>y will be 3 ,3存為int型態並設定給y z=float(3)>>>z will be 3.0, 3存為float型態並設定給z thislist=['watermelon','apple','banana','mango','cocona','grava','strawberry'] print(thislist)得['watermelon', 'apple', 'banana', 'mango', 'cocona', 'grava', 'strawberry'] print(len(thislist))得7 #此為長度 print(thislist[0:4])得['watermelon', 'apple', 'banana', 'mango'] #取0~4之前(3)取0~4之前(3) --- thislist.append()後面加入 remove()其中移除 sort()排序 ## 作業 題目: 把資料排序 lst=[總之很多數字就對了] lst.sort(reverse=True) #True為由大到小 False為由小到大 print(lst) # 3/14 第五週 ## 內容 lst=['a','b','c','d','e'] #宣告lst有五個元素,分別為a,b,c,d,e字串 lst[2]='x' #將lst中編號為2的字串設定為x字串 lst.append('c') #將lst增加c字串到最後一列 lst.remove('a') #將lst移除a字串 print(lst) #印出lst 得:['b', 'x', 'd', 'e', 'c'] lst.sort() #將字串由小至大排列 得"['b', 'c', 'd', 'e', 'x'] #迴圈 for i in lst: # 針對lst中的每一個元素i(也就是說我們用i代表每一個元素) #loop #走訪串列的每個元素 #for迴圈 print(i) a=[1,2,3,4,5] for x in a:(冒號記得) if x>3 : #如果x大於3,我們才把他印出來 (空一格) print(x)(空兩格) #彙整函數 len=>長度 max=>最大 min=>最小 sum=>加總 count('x')看x出現幾次 ## 作業1 (方法一) lst=[1,2,3,4,5] b=0 c=0 for x in lst: print(f'x={x}') b=b+x print(f'b={b}') print(b) c=c+x+b print(f'c={c}') print(c) print(c) 得:x=1 b=1 1 c=2 2 x=2 b=3 3 c=7 7 x=3 b=6 6 c=16 16 x=4 b=10 10 c=30 30 x=5 b=15 15 c=50 50 50 ## 作業2 lst=[1,2,3,4,5] c=0 for y in lst: if y>c: c=y print(c) 得:5 # 3/21 第六週 ## 內容 [手寫該六題算法](https://colab.research.google.com/drive/1GN907W1lAFim-eVAr935NBKjvOcbZI33?usp=sharing) ![](https://i.imgur.com/ReUhxmR.png) ## 作業 無 # 3/28 第七週 ## 內容 圖表製作 ```python= import matplotlib.pyplot as plt a=[1,2,3,4,5] b=[1,2,3,4,5] plt.scatter(x=a,y=b,s=10) plt.axis('square') plt.xlim(0,6) plt.ylim(0,6) print(f'我的圖形') plt.show() ``` 得 ![](https://i.imgur.com/JVc4rv2.png) 字典製作 ```python= dic={'WaterMelon':100, 'Apple':40} print( dic['WaterMelon'] ) print(dic['Apple']) dic={5:100, 6:40} print( dic[5] ) ``` 得 100 40 100 ## 作業 ~~這邊先假設我們已經把一大坨dict做完了~~ ### 第一題(用迴圈找出"麥禮仁"的學號))) ```python= for x,y in dict.items(): if "麥禮仁" in y: print(x) ``` 得:109213504# ### 第二題(用迴圈找出所有"陳"姓同學的學號與姓名) ```python= for x,y in dict.items(): if "陳" in y: print(x,y) ``` 可得所有結果# ### 第三題(全班同學有那幾個姓氏?同學姓名是否有重複的?) ```python= list=[] lst=[] for x,y in dict.items(): lst.append(y[0]) if y[0] not in list: list.append(y[0]) print(*list) print(len(list)) print(*lst) print(len(lst)) ``` 得到*list=麥 稅 林 王 洪 黃 陳 郭 董 高 謝 江 楊 趙 周 鍾 劉 鄭 朱 溫 許 顏 魏 蔣 何 李 吳 粘 戚 廖 古 韓 潘 傅 翟 譚 葉 蕭 張 薛 蘇 邱 盧 簡 長度為:44 為前半小題答案# 而lst長度為92 與44不符合 得到答案為:有重複姓氏 為後半小題答案# ### 第四題(歡迎某某某同學參加我們的營隊) print(f'歡迎{dict["110251001"]}同學參加我們的營隊活動') {中間可替換} 該題得:歡迎董哲安同學參加我們的營隊活動 # 4/4 第八週 ## 內容 連假停課一週 ## 作業 無 # 4/11 第九週 ## 內容 將Colab與雲端掛接 第一步: 點開Colab左測第4個檔案符號 點選第三個 與雲端硬碟掛接,若上方出現劃掉的符號即為成功。 **第一功能** #手工掛載雲端硬碟 #寫入CSV with open('/content/drive/MyDrive/’___TestData’/001_Hello.txt', 'w') as f: #open 後方()內放入檔案位置,檔案須預先創製) f.write('Hello Google Drive') #此舉將寫入一(Helllo Google Drive)資料夾於先前創製的資料夾中 **第二功能** #讀取CSV with open('/content/drive/MyDrive/’___TestData’/001_Hello.txt', 'r') as f: ss=f.read() #此舉可閱讀資料夾內文字) print(ss) #印出文字 **第三功能** #刪除檔案 import os if os.path.exists("/content/drive/MyDrive/___DataSet//001_Hello.txt"): #偵測該檔案是否存在 os.remove("/content/drive/MyDrive/___DataSet//001_Hello.txt") #若存在即刪除該檔案 print("檔案已經刪除") #若檔案存在即印出檔案已刪除 else: print("檔案不存在") #若檔案不存在即印出檔案不存在 **第四功能** #讀取雲端硬碟中的excel檔 import pandas as pd df = pd.read_excel("/content/drive/MyDrive/’___TestData’/001_Income_F.xlsx") #001_Income_F.xlsx 須預先下載並拖入資料夾 df #直接df為先前設定過df 即可直接印出檔案 #讀取雲端硬碟中的excel檔 import pandas as pd df = pd.read_excel("/content/drive/MyDrive/’___TestData’/110 學年度全國大專校院及校長名錄(含學校本部地址).xlsx") #同樣做法 一樣須先下載並拖入資料夾 df #讀取雲端硬碟中的excel檔 import pandas as pd df = pd.read_csv("/content/drive/MyDrive/’___TestData’/opendata110road.csv") #記住此處為csv檔 df #讀取雲端硬碟中的excel檔 import pandas as pd df = pd.read_excel("/content/drive/MyDrive/’___TestData’/活頁簿1.xlsx") #活頁簿為自建 一樣要拖入 df 此處與下方相同 下方為用打得來創建 import pandas as pd grades = { "name": ["Mike", "Sherry", "Cindy", "John"], "math": [80, 75, 93, 86], "chinese": [63, 90, 85, 70]} df = pd.DataFrame(grades) print("使用字典來建立df:") print(df) print("=====================") grades = [ ["Mike", 80, 63], ["Sherry", 75, 90], ["Cindy", 93, 85], ["John", 86, 70] ] df = pd.DataFrame(grades) print("使用陣列來建立df:") print(df) 完整建立一個列陣為下 import pandas as ab grades={ "學號":["A00A","A002","A003","A004","A005"], "體重":["90","30","50","45","72"], "身高":["120","180","160","155","178"]} ab = pd.DataFrame(grades) print("使用字典來建立df:") print(ab) print方式 **方式一** ab["身高"] 得 0 120 1 180 2 160 3 155 4 178 Name: 身高, dtype: object **方式二** print(ab[["身高","體重"]]) 得 身高 體重 0 120 90 1 180 30 2 160 50 3 155 45 4 178 72 **方式三** print(ab[0:3]) 得 身高 體重 0 120 90 1 180 30 2 160 50 3 155 45 4 178 72 ## 作業 ### 1.將表格一行恆著印出來(迴圈) .3. ### 2.將表格中所有元素印出來(雙迴圈) .3. # 4/18 第十週 ## 內容 考試沒有上課一週 ## 作業 無 # 4/25 第十一週 ## 內容 1.檢討可悲的考卷 2.講解個人加分作業 ## 作業 研究題目:___分佈之研究 #例子 國立暨南國際大學 資管系 戴榮賦 1 國立暨南國際大學 經濟系 麥禮仁 2 國立暨南國際大學 資管系 麥禮仁(小天使) 3 聯絡方式: rfday@ncnu.edu.tw rfday@ncnu.edu.tw 研究背景 400~1000字 研究問題 一句話講清楚一個問題 研究發現 從羅倫茲曲線,我們可以發現到.... 從吉尼係數,我們可以發現到.... 500~1000字 結論 我們國家的國民所得分佈是... 在理論上,這代表著... 至少寫兩點 至少寫兩點 在實務上,我們建議[]應該採取下列作為。 至少寫兩點 至少寫兩點 總之,... 500~1500字 參考文獻 國立暨南國際大學資訊管理學系 至少要三個項目 #### 程式碼 import pandas as pd import numpy as np import matplotlib.pyplot as plt dfIncome = pd.read_excel('/content/drive/MyDrive/Income/001_Income_F (1).xlsx') dfIncome dfLorenz=dfIncome[:] se=dfLorenz['Income'].sort_values() cumulativeSum=0 i=0 xx=[] yy=[] for x in se: i=i+1 cumulativeSum+=x xx.append(i/n) yy.append(cumulativeSum/sum) plt.plot([0,1], linestyle = 'dotted') #散佈圖 plt.scatter(x=xx,y=yy,s=0.1) plt.axis('square') plt.xlim(0,1) plt.ylim(0,1) print('羅倫茲曲線(Lorenz curve)') plt.show() B=np.trapz(yy,xx) A=0.5-B gini=A/(A+B) print(gini) #### 研究題目:貧富分布之研究 國立暨南國際大學 管院學士班 董哲安 1 (組員) 國立暨南國際大學 管院學士班 王雅蓁 2 (組員) 國立暨南國際大學 資管系 廖唯任 3 (小天使) 國立暨南國際大學 資管系 賴芃希 4 (小天使) #### 研究背景: 首先我要誠實的說,我們考試考得太過於不盡理想,為求pass,所以我們才會「主動」來進行這種不在基本要求內的研究。這並非說我們對其不感興趣,但我認為我們太早接觸,對其只有過於淺層的了解,恐怕會造成誤解,也只能想出制式化的解決方案與原因。但提早了解確實也對於後期深入探討有正面的影響,所以我們也樂意一同進行研究,畢竟這是個winwin的結果。 :::success 老師有看到了 ::: 眾所周知,台灣並不是一個貧富分布均衡的地方,在亞洲中,我們平均程度已經算是很好的國家。然而,以世界來看,世界上沒有任何一個地方能夠沒有貧富不均,就算是所謂的共產也不可能達到,有差別的大概也就只是不均的程度高或低。 透過這次的研究,希望能夠讓我們更清楚的瞭解到台灣的貧富差距究竟現況如何,與之發生的原因和解決方法,並能夠為未來的深層研究鋪路,提早對其有一定程度的了解。也透過這次的機會再次複習與學習程式設計的相關知識,同時能夠練習程式設計在現實事件的應用,以增進已學過的知識和現實情境的貼近程度 #### 研究發現 勞倫茲曲線: 勞倫茲曲線是一條經濟學中常使用的工具,羅倫茲曲線是在過往財富分配數據上建立的累積分布函數所對應的曲線。在其中,我們能夠明白當x=y時,代表該國家的貧富差距非常的小,也就是每1%的人口基本上都可以佔有整個國家1%的資源,然而該情況已人性來說是不可能達成的,而該目標也唯真正的「共產主義」目標。 而透過研究,我們可以清楚地明白,基本上,百分之百的國家都不可能達成,而當一個國家越大,經濟發展水準越高,其貧富差距也會同時加大,儘管透過顧志耐曲線告訴我們貧富差距應該事前加大,後期放緩至頻均,然而,目前似乎沒有國家成功走到後期,所以我們的勞倫茲曲線得到的國家曲線都是在平均線下的一條內凹曲線,而該曲線和平均曲線差的越遠,就同時代表該國家的貧富差距越大。 台灣在這條曲線中唯一漂亮的彎月,也代表著離平均現有著不算短的差距,其警示我們台灣並不是個貧富平衡的的國家,而是一個充滿競爭與階級不平均的地區。 吉尼係數: 吉尼係數是一條以勞倫茲曲線為基底的新導係數,基本公式唯國家曲線和x軸y軸夾住的範圍為B;平均曲線與x軸y軸夾住的範圍減去B範為便為A,而A/(A+B)即為吉尼係數的公式。在此係數中,越接近0代表該國貧富差距越平均,越接近一代表差距越大。 反觀台灣,透過老師給的10000筆資料,得到的結果為大約0.46 若低於0.2表示指數等級極低; 0.2-0.29表示指數等級低; 0.3-0.39表示指數等級中; 0.4-0.59表示指數等級高; 0.6以上表示指數等級極高。 可知台灣的貧富差距十分驚人,已處於高的階段,和官方公布的0.274低階段有相當大的不合,也許伴隨著資料量持續加大至全國數量兩者才會重合,而在這一步,更可以知道台灣的貧富差距有多大,因為我們目前只是選擇了一小部分,可能剛好拉到較多的富與較少的貧,才會導致係數高居不下。不過儘管只有0.274也代表著貧富差距懸殊,但不至於階級僵化無法改變而已,國家整體仍須努力。 #### 結論 我們國家的國民所得分佈明顯不均 在理論上代表著 1.教育和醫療的落差 2.社會的動盪不安 在實務上,我們建議應該採取 1.提高弱勢族群就業能力 2.訂定更公平的稅負制度 總之,在現今社會上,不論經濟發展狀況如何,都存在著貧富差距。隨著科技技術越來越進步,造就許多國家經濟迅速發展,但是賺到的那些錢只會落入少數收入本來就不差的人手中,因為本來很貧窮的人,沒辦法做技術高的工作,收入自然也不多,就會導致人均GDP雖然是上升的狀態,但其實是有錢的人更有錢,沒錢的人還是沒錢,貧富差距逐漸擴大。台灣也是如此,貧窮跟富有彷彿有一條很深的溝,很難跨越,底層的人很難有翻身的機會,這是政府當前迫切需要改善的問題,想辦法讓這些人能夠享有基本生活水準。雖然台灣相較於鄰近國家還不到太差,但因為貧富差距使教育及醫療資源落差擴大,以及每年街頭都會上演的勞工團體抗議,已經不是稀奇的事。若想改善現況,政府必須先擬定政策、法令,提升弱勢族群就業能力、訂定更公平的稅負制度,雖然懸殊的差距無法完全消除,但至少貧富不均的問題可以獲得控制。 # 5/2 第十二週 ## 內容 上上週作業做出來的人太少,所以本周老師講解作業做法 勸我們多練習一些城市寫法 ## 作業 好像這週沒有安排上 但是開會還是召開拉 然後我們搞出了新的吉尼係數方法 import os import numpy as np import pandas as pd dfIncome = pd.read_excel('/content/drive/MyDrive/Income/001_Income_F (1).xlsx') wealths = [] #定義一個wealths陣列用於存放所有的資料 #以下開始將txt檔案的資料逐個輸入wealths陣列 for i in dfIncome['Income']: #line = list(line.strip().split('/n')) #strip移除字串頭尾指定的字元(預設為空格或換行符),split指定分隔符對 字串進行切片 #for i in line: wealths.append(int(i)) #逐個追加入wealths陣列 #列印wealths陣列,看一下有沒有讀入資料錯誤 for i in range(0,len(wealths)): print(wealths[i]) #基尼係數計算的函式 def gini_coef(wealths): cum_wealths = np.cumsum(sorted(np.append(wealths, 0))) sum_wealths = cum_wealths[-1] xarray = np.array(range(0, len(cum_wealths))) / np.float(len(cum_wealths)-1) yarray = cum_wealths / sum_wealths B = np.trapz(yarray, x=xarray) A = 0.5 - B return A / (A+B) #列印基尼係數結果 print("\n基尼係數是%f"%gini_coef(wealths)) # 5/9 第十三週 ## 內容 ![](https://i.imgur.com/eYe3s0e.png) ## 作業 ㄟ不是我們討論很多好嗎 比如說期末作業= = # 5/16 第十四週 ## 內容 函數 defined using the def keyword: (自己設定一個東西以便未來使用) def my_function(): print('Hello_World') my_function() 得Hellow_World --- #計算1,2,....n總 def Sum1toN(n): s=0 #n=10 for i in range(1,n+1): s=s+i return s Sum1toN(1000) 得500500 --- 計算m+1,m+2....+n總和 def SumMtoN(m,n): s=0 #n=10 for i in range(m+1,n+1): s=s+i return s SumMtoN(5,10) 得40 --- def my_fun(x,y,z): print(x+'你知道嗎:'+y+' '+z) def my_fu(x,y): print(x+y) my_fun(y='筱明',x='天氣有點冷',z='不准只短袖') my_fu(3,5) my_fu(y=5,x=2) 得 天氣有點冷你知道嗎:筱明 不准只短袖 8 7 ## 作業 自己搞一個return def sleeping(x,y): z=x*y return z b=sleeping(8,7) print(b) 得56 # 5/23 第十五週 ## 內容 小考喔 ## 作業 沒有

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully