#查看 print(df.head(2)) print(df.tail()) # .head()查看头部数据 # .tail()查看尾部数据 # 默认查看5条 print(df.T)# .T 转置 # 新增列/行并赋值 df['e'] = 10 df.loc[4] = 20 print(df) # 索引后直接修改值 df['e'] = 20 df[['a','c']] = 100 print(df) #删除 del df['a'] print(df.drop(['d'], axis = 1)) print(df.drop(0)) print(df.drop([1,2])) print(df.drop(['d'], axis = 1))