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.
Note
Some tables in the course, such as the one below, contain numerous columns. Therefore, you may need to scroll horizontally to see all the columns.
Title | Director | Stars | IMDb-Rating | Category | Duration | Censor-board-rating | ReleaseYear |
---|---|---|---|---|---|---|---|
Top Gun: Maverick | Joseph Kosinski | Tom Cruise, Jennifer Connelly, Miles Teller, Val Kilmer... | 8.6 | Action, Drama | 130min | UA | 2022 |
Everything Everywhere All at Once | Dan Kwan, | Michelle Yeoh, Stephanie Hsu, Ke Huy Quan, James Hong... | 8.3 | Action, Adventure, Comedy | 139min | R | 2022 |
The Batman | Matt Reeves | Robert Pattinson, Zoë Kravitz, Jeffrey Wright, Colin Farrell... | 7.9 | Action, Crime, Drama | 176min | UA | 2022 |
Jurassic Park | Steven Spielberg | Sam Neill, Laura Dern, Jeff Goldblum, Richard Attenborough... | 8.2 | Action, Adventure, Sci-Fi | 127min | UA | 1993 |
The Godfather | Francis Ford Coppola | Marlon Brando, Al Pacino, James Caan, Diane Keaton | 9.2 | Crime, Drama | 175min | A | 1972 |
This table will help you understand how to output specific columns:
Function's Purpose | Syntax | Output |
---|---|---|
Extract one column by title | data['Director'] |
All values from column 'Director' |
Extract several columns by title | data[['Title', 'Stars']] |
All values from column 'Title' and relevant values from the column 'Stars' |
¿Todo estuvo claro?
Contenido del Curso
Advanced Techniques in pandas
1. Get Familiar With Indexing and Selecting Data
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.
Note
Some tables in the course, such as the one below, contain numerous columns. Therefore, you may need to scroll horizontally to see all the columns.
Title | Director | Stars | IMDb-Rating | Category | Duration | Censor-board-rating | ReleaseYear |
---|---|---|---|---|---|---|---|
Top Gun: Maverick | Joseph Kosinski | Tom Cruise, Jennifer Connelly, Miles Teller, Val Kilmer... | 8.6 | Action, Drama | 130min | UA | 2022 |
Everything Everywhere All at Once | Dan Kwan, | Michelle Yeoh, Stephanie Hsu, Ke Huy Quan, James Hong... | 8.3 | Action, Adventure, Comedy | 139min | R | 2022 |
The Batman | Matt Reeves | Robert Pattinson, Zoë Kravitz, Jeffrey Wright, Colin Farrell... | 7.9 | Action, Crime, Drama | 176min | UA | 2022 |
Jurassic Park | Steven Spielberg | Sam Neill, Laura Dern, Jeff Goldblum, Richard Attenborough... | 8.2 | Action, Adventure, Sci-Fi | 127min | UA | 1993 |
The Godfather | Francis Ford Coppola | Marlon Brando, Al Pacino, James Caan, Diane Keaton | 9.2 | Crime, Drama | 175min | A | 1972 |
This table will help you understand how to output specific columns:
Function's Purpose | Syntax | Output |
---|---|---|
Extract one column by title | data['Director'] |
All values from column 'Director' |
Extract several columns by title | data[['Title', 'Stars']] |
All values from column 'Title' and relevant values from the column 'Stars' |
¿Todo estuvo claro?