Course Content
Advanced Techniques in pandas
Output Columns by Title
You are already familiar with the functions that can output the dataset, but imagine you want to output only a specific column. Firstly, let's get acquainted with the dataset for this section. By the way, it is inconvenient to output the whole data set, so data analysts usually output a part of it to examine. In this course, we will usually output the first 5 rows.
Title | Director | Stars | IMDb-Rating | Category | Duration | Censor-board-rating | ReleaseYear | |
0 | Top Gun: Maverick | JosephKosinski | TomCruise, JenniferConnelly, MilesTeller, ValK... | 8.6 | Action,Drama | 130min | UA | 2022 |
1 | Everything Everywhere All at Once | DanKwan, | , MichelleYeoh, StephanieHsu, KeHuyQuan, James... | 8.3 | Action,Adventure,Comedy | 139min | R | 2022 |
2 | The Batman | DanKwan, | RobertPattinson, ZoëKravitz, JeffreyWright, Co... | 7.9 | Action,Crime,Drama | 176min | UA | 2022 |
3 | Jurassic Park | MattReeves | SamNeill, LauraDern, JeffGoldblum, RichardAtte... | 8.2 | Action,Adventure,Sci-Fi | 127min | UA | 1993 |
4 | The Godfather | StevenSpielberg | MarlonBrando, AlPacino, JamesCaan, DianeKeaton | 9.2 | Crime,Drama | 175min | A | 1972 |
This table will help you understand how to output specific columns:
Function's Purpose | Syntax | Output |
data['Director'] | Extract one column by title | All values from column 'Director' |
data[['Title', 'Stars']] | Extract several columns by title | All values from column 'Title' and relevant values from the column 'Stars' |
We want to output 'Category' and 'IMDb-Rating' columns; choose the correct way to do so.
Select the correct answer
Section 1.
Chapter 1