Pandas 安装
pip instead pandas
import pand as pd
#设置名称参数
a=["Google","Runoob","Wiki"]
date=pd.Series(a,index=["x","y","z"])
print(date)
data = {
"calories":[420,380,390],
"duration":[50,40,45]
}
#数据载入到DataFrame对象
df = pd.DataFrame(data)
#返回第一行
print(df.loc[0])
#返回第二行
print(df.loc[1])
#读取末尾5行
df = pd.read_csv('nba.csv')
print(df.tail())
#读取末尾10行
df=pd.read_csv('nba.csv')
print(df.tail(10))
#字典格式的
JSONs = {
"col1":{"row1":1,"row2":2,"row3":3},
"col2":{"row1":"x","row2":"y","row3":"z"}
}
#读取JSON转为
DataFramedf=pd.DataFrame(s)
print(df)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)