df[‘compound’] = compound
这种用法即:df是个字典
获取他的值(键-值)
dict = {"compound": 123}
>>> d["compound"]
123
df.compound
df是个对象,compound是它的属性
获取其属性
d = {"compound": 123}
d.compound
'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'dict' object has no attribute 'compound'
一个普通的字典,用d.compound取值就会报AttributeError,说明没有这个属性
用d["bbb"]就会报KeyError,说明没有这个键值。
'