Use the iloc() function to extract the first 20 features of the dataframe code example Example: pandas iloc select certain columns dataframe.iloc[:,[1,2]]