For this tutorial, we will import the following dataset: Adult (census income), from the UCI Machine Learning Repository. It contains data of 48,842 people from the 1994 US Census, with age, education ...
1.1 列表的天然短板:重复元素与线性查找 先明确一点:Python 的 set 在概念上对应数学里的“集合”,它用来装一组互不相同的元素。而列表什么都能装,天生允许重复,也天然保持输入顺序。这两个特性在大多数时候是优点,但在去重和快速查找场景下就变成了短板。
3.3 字典:哈希机制与遍历顺序 Python 3.7之后,字典正式保证插入顺序。 这改变了很多代码的写法,比如以前需要用 OrderedDict 的场景现在直接用 dict 就行。 字典的键必须是可哈希的。 可哈希意味着对象在其生命周期内哈希值不变,且能与其他对象比较相等。
Some results have been hidden because they may be inaccessible to you
Show inaccessible results