Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Output Columns by Title
course content

Course Content

Advanced Techniques in pandas

Output Columns by TitleOutput 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'

question-icon

We want to output 'Category' and 'IMDb-Rating' columns; choose the correct way to do so.

Select the correct answer

Everything was clear?

Section 1. Chapter 1
some-alt