In [1]:
import pandas as pd
url="http://stats.moe.gov.tw/files/detail/107/107_students.csv"
df = pd.read_csv(url)
df.head()
Out[1]:
In [2]:
df.columns
Out[2]:
In [3]:
df['學校代碼'].drop_duplicates().count()
Out[3]:
In [4]:
df['學校名稱'].drop_duplicates().count()
Out[4]:
In [5]:
df['科系名稱'].drop_duplicates().count()
Out[5]:
In [6]:
df['科系代碼'].drop_duplicates().count()
Out[6]:
In [7]:
df[df['科系代碼'] == '01111001']
Out[7]:
In [8]:
df[(df['學校代碼'] == 1) & (df['等級別']== 'B 學士') ].sum()
Out[8]:
In [9]:
undergraduate = df[(df['學校代碼'] == 1) & (df['等級別']== 'B 學士') ].sum()
undergraduate['一年級男生':'延修生女生'].sum()
Out[9]: