本文数据是大学专业和就业的信息。有两个csv文件all-ages.csv和recent-grads.csv
- 主要的属性如下:
Rank - The numerical rank of the major by post-graduation median earnings.
Major_code - The numerical code of the major.
Major - The description of the major.
Major_category - The category of the major.
Total - The total number of people who studied the major.
Men - The number of men who studied the major.
Women - The number of women who studied the major.
ShareWomen - The share of women (from 0 to 1) who studied the major.
Employed - The number of people who studied the major and were employed post-graduation.
- recent-grads.csv
- all-ages.csv和这个类似,只是某些列的值不同
Summarizing Major Categories
计算两个数据集中每个Major Categories(每个Major Categories包含多个Major
)的就读的人数。
- Series.value_counts返回的是该Series对象中独一无二的元素的个数(Returns object containing counts of unique values.)是个Series对象。
print(all_ages['Major_category'].value_counts())
'''
Engineering 29
Education 16
Humanities & Liberal Arts 15
Biology & Life Science 14
Business