nd = np.array([150,150,150,300])
s1 = Series(nd,index=["语文","数学","英语","理综"])
s1结果为
语文 150
数学 150
英语 150
理综 300
dtype: int32
nd[0] = 1000
s1 由数组和列表创建Series是一个浅拷贝(只拷贝引用地址,不拷贝对象本身)
语文 1000
数学 150
英语 150
理综 300
dtype: int32
dic = {"语文":150,"数学":150,"英语":150,"理综":300}
s2 = Series(dic)
s2
语文 150
数学 150
英语 150
理综 300
dtype: int64
dic["数学"] = 120
s2 由字典创建Series是一个创建副本的过程(也叫深拷贝)
语文 150
数学 150
英语 150
理综 300
dtype: int64