实例:数据查看
#切片
import pandas as pd
import numpy as np
data = pd.DataFrame({
'id':[1,3,2],'name':['a','b','c']},index=[0,1,2])
print('data:\n',data)
#查看指定列
print('id列:\n',pd.DataFrame(data['id']))
print('id、name两列:\n',data.loc[:,['id','name']])
print('第2列:\n',pd.DataFrame(data.iloc[:,1]))
#查看指定行列
print('name列的前两行:\n',pd.DataFrame(data,index=[0,1],columns=['name']))
print('name、id两列的前三行:\n',data.loc[0:2