从arr.csv文件中读取
arr.csv
date,s1,s2,s3,s4,s5
05-21,27.93 ,28.18 , 29.39 ,40.52 , 26.26
05-22,58.08 ,50.61 , 51.62 ,48.55 ,54.03
05-23,38.67 ,31.73 ,57.91 ,59.23 ,49.08
05-24,45.83 ,31.48 ,45.94 ,71.21 ,46.53
05-25,70.26 ,55.96 ,53.81 ,58.48 ,43.23
05-26,46.61 ,22.73 ,45.77 ,63.63 ,56.79
05-27,49.73 ,40.47 ,69.13 ,55.16 ,58.71
05-28,34.02 ,42.02 ,28.75 ,34.90 ,26.43
05-29,56.64 ,31.39 ,43.43 ,54.65 ,44.97
05-30,57.28 , 64.21 ,55.79 , 68.03 ,54.16
read_csv
将csv文件加载为DataFrame
describe
获取DataFrame中数据的描述信息
import pandas as pd
df = pd.read_csv('arr.csv',index_col = 'date')
#获取DataFrame中数据的描述信息,比如均值、最大最小值等
print(df.describe())
#按列访问
print(df['s1'])
#按行访问
print(df.loc['05-21'])
按列计算
axis=0、axis='index'
按行计算
axis = 1,axis='columns'