Working with DataFrame必备知识点
①只输出指定的列
输出WC_DF2中的"city_ascii","population"两列
WC_DF2 = WC_DF2[["city_ascii","population"]]
②筛选满足对应条件的行
筛选出国家为“China”的行
WC_DF2 = WC_DF2[WC_DF2['country'] == "China"]
③对某一列求和
求population列的总和
WC_DF2['population'].sum()
......
原创
2021-11-18 00:23:03 ·
95 阅读 ·
0 评论