第一章 导论:
A data scientist is someone who extracts insights from messy data.(数据科学家是能从数据中剥离出洞见的人。)
1..
from collections import Counter #Counter 首字母要大写
Counter()函数用于对序列进行统计,返回值为一个元素类型为键值对的特殊序列。
具体参考:Python collections.Counter()用法_qwe1257的博客-优快云博客_collections.counter 排序
2.
from collection import defaultdict
defaultdit() 函数用于创建一个value默认为给定参数类型的空字典,例如d = defaultdict(int/list/tuple/set...)分别产生一个value默认值为int(),list(),tuple(),set()的空字典。
具体参考:Python中的defaultdict方法_yeal-优快云博客_defaultdict
3.集合、字典等在创建时也可以类似列表采用解析式的方式:如:
d = { x : y for x,y in {'a':1,'b':2}.items()}
4.for in 循环语句中for后变量可以是若干个,与in后iteration中的每个元素要一一对应。如