series(序列)
可理解为有索引的ndarray数组
- 创建
1.a = pd.Series([2,3,6],index = [“i”,“u”,3])
2.字典定义
双索引机制
Dataframe(数据框)
可理解为若干个相同索引构成的序列
- 创建()
a=pd.DataFrame(np.random.randn(6,3),
index = range(2,8),
columns = ["a","b","c"])
a.index
a,columns
#同时也可以1通过字典来构建和2转换序列来构建字典
- 通过文件读入
r1 = pd.read_csv(r"E:\data.txt",
names=["user","brand"]
sep = "\t"
dtype ="int64")
r1.head()
r1.user
Index 索引
可看做一个集合(可用运算符±&|^(异或))
- 创建
b = pd.Index([1,2,3])
索引具有元组的特性,不可更改
索引具有集合的特性,不能重复