pandas的常用数据类型
1.Series 一维,带标签数组 2.DataFrame 二维,Series容器
pandas之Series创建
import pandas as pd
t1=pd.Series([1,4,6,2,8,6],index=list("abcdef"))
print(t1)
print(t1.head(2))
print(t1.tail(2))
tem_dict={"name":"yiyi","age":"18"}
t2=pd.Series(tem_dict)
pandas之Series切片和索引
import pandas as pd
t1=pd.Series([1,4,6,2,8,6],index=list("abcdef"))
print(t1)
print(t1.head(2))
print(t1.tail(2))
tem_dict={"name":"yiyi","age":"18"}
t2=pd.Series(tem_dict)
print(t2)
print(t2["name"])
print(t2["age"])
print(t2[0])
print(t2[1])
print(t1[t1>3])
|