1df1 = df.iloc[:,0:2] # Remember that Python does not slice inclusive of the ending index.
1In [25]: titanic.iloc[9:25, 2:5]
2Out[25]:
3 Pclass Name Sex
49 2 Nasser, Mrs. Nicholas (Adele Achem) female
510 3 Sandstrom, Miss. Marguerite Rut female
611 1 Bonnell, Miss. Elizabeth female
712 3 Saundercock, Mr. William Henry male
813 3 Andersson, Mr. Anders Johan male
9.. ... ... ...
1020 2 Fynney, Mr. Joseph J male
1121 2 Beesley, Mr. Lawrence male
1222 3 McGowan, Miss. Anna "Annie" female
1323 1 Sloper, Mr. William Thompson male
1424 3 Palsson, Miss. Torborg Danira female
15
16[16 rows x 3 columns]
17