比如这个数据:
= pd.DataFrame([ ('jack', 34, 'Sydeny') ,
students 'Riti', 30, 'Delhi' ) ,
('Aadi', 16, 'New York') ], columns = ['Name' , 'Age', 'City'], index=['a', 'b', 'c']) (
Name Age City
a jack 34 Sydeny
b Riti 30 Delhi
c Aadi 16 New York
注意列号是从0开始的。取出列号为1的列:
1] students.iloc[:,
a 34
b 30
c 16
Name: Age, dtype: int64
取出列号为0和2的列:
0,2]] students.iloc[:,[
Name City
a jack Sydeny
b Riti Delhi
c Aadi New York