the examples given here are self-explanatory and you can refer to the numpy section for more details similar slicing rules apply for dataframes also but the only difference is that now simple slicing refers to the slicing of rows and all the other columns will end up in the result consider the following example in [ ]city_data[: out[ ]city city_ascii lat lng pop country qal eh-ye now qal eh-ye afghanistan chaghcharan chaghcharan afghanistan lashkar gah lashkar gah afghanistan zaranj zaranj afghanistan tarin kowt tarin kowt afghanistan zareh sharan zareh sharan afghanistan asadabad asadabad afghanistan iso iso province af afg badghis af afg ghor af afg hilmand af afg nimroz af afg uruzgan af afg paktika af afg kunar for providing access to specific rows and specific columnspandas provides useful functions like iloc and loc which can be used to refer to specific rows and columns in dataframe there is also the ix function but we recommend using either loc or iloc the following examples leverages the iloc function provided by pandas this allows us to select the rows and columns using structure similar to array slicing in the examplewe will only pick up the first five rows and the first four columns in [ ]city_data iloc[: ,: out[ ]city city_ascii lat lng qal eh-ye now qal eh-ye chaghcharan chaghcharan lashkar gah lashkar gah zaranj zaranj tarin kowt tarin kowt another access mechanism is boolean based access to the dataframe rows or columns this is particularly important for dataframesas it allows us to work with specific set of rows and columns let' consider the following example in which we want to select cities that have population of more than million and select columns that start with the letter lin [ ]city_data[city_data['pop' ][city_data columns[pd series(city_data columnsstr startswith(' ')]out[ ]lat lng